Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Ustawienie domyślnej podstrony
kondziopel
post 28.05.2016, 12:01:34
Post #1





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 27.05.2016

Ostrzeżenie: (0%)
-----


Panowie, nie działa funkcja default i nie moge ustawić domyślnej podstrony zeby sie wyświetlała...
Jakieś pomysły? Pierwszy raz sie bawie ajaxem

Zawartość ajax.js:
Kod
disableButtons = false;

function loadArticle(id)
{
  if(disableButtons) return;
  switch(id){

    case 1 : url = "podstrona1.php";break;
    case 2 : url = "podstrona2.php";break;
    case 3 : url = "podstrona3.php";break;
    default : case 1;
  }
  disableButtons = false;
  startGETRequest(url, onComplete, onEnd);
}

function onComplete(text, xml)
{
  var dataDiv = document.getElementById('dataDiv');
  dataDiv.innerHTML = text;
}

function onEnd(text, xml)
{
  disableButtons = false;
}


Ten post edytował kondziopel 28.05.2016, 12:01:59
Go to the top of the page
+Quote Post
viking
post 28.05.2016, 12:21:58
Post #2





Grupa: Zarejestrowani
Postów: 6 378
Pomógł: 1116
Dołączył: 30.08.2006

Ostrzeżenie: (0%)
-----


default: url = "podstrona1.php";


--------------------
Go to the top of the page
+Quote Post
kondziopel
post 28.05.2016, 12:33:42
Post #3





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 27.05.2016

Ostrzeżenie: (0%)
-----


Nie działa to własnie, próbowałem już...
może trzeba coś do indexu dodać?
U mnie to tak wygląda:
Kod
<div id="selectorsDiv" class="mainDiv">
<input type="button" class="myButton" value="Wyślij wiadomość"
       onclick="loadArticle(1)" id="btn1">
<input type="button" class="myButton" value="Team Speak 3"
       onclick="loadArticle(3)" id="btn3">
<input type="button" class="myButton" value="Media społecznościowe"
       onclick="loadArticle(2)" id="btn2">
</div>
Go to the top of the page
+Quote Post
viking
post 28.05.2016, 12:51:31
Post #4





Grupa: Zarejestrowani
Postów: 6 378
Pomógł: 1116
Dołączył: 30.08.2006

Ostrzeżenie: (0%)
-----


A co zwraca konsola? Jakieś błędy przed wysłaniem, jeśli nie to czy w odpowiedzi dostajesz poprawne dane


--------------------
Go to the top of the page
+Quote Post
kondziopel
post 28.05.2016, 12:55:10
Post #5





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 27.05.2016

Ostrzeżenie: (0%)
-----


Blędów związanych z tym nie ma, w odpowiedzi dostaje poprawne dane, wszystko działa oprócz tego własnie co chce zrobic
Go to the top of the page
+Quote Post
viking
post 28.05.2016, 13:09:08
Post #6





Grupa: Zarejestrowani
Postów: 6 378
Pomógł: 1116
Dołączył: 30.08.2006

Ostrzeżenie: (0%)
-----


Czyli skoro wczytuje problem nie jest w loadArticle.
Daj sobie console.log w poszczególnych krokach i zobacz gdzie się zatrzymuje.


--------------------
Go to the top of the page
+Quote Post
kondziopel
post 28.05.2016, 13:22:22
Post #7





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 27.05.2016

Ostrzeżenie: (0%)
-----


Te błędy mi wywala po error tescie;

InjectedScript._evaluateOn @VM195:145
InjectedScript._evaluateAndWrap @VM195:137
InjectedScript.evaluate @VM208:3
Go to the top of the page
+Quote Post
viking
post 28.05.2016, 14:47:41
Post #8





Grupa: Zarejestrowani
Postów: 6 378
Pomógł: 1116
Dołączył: 30.08.2006

Ostrzeżenie: (0%)
-----


A nie ma tam wcześniej uncaught coś i dopiero te błędy?


--------------------
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 29.06.2025 - 17:29