Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [ajax] advajax i kilka funkcji
grzegorz_g
post
Post #1





Grupa: Zarejestrowani
Postów: 259
Pomógł: 0
Dołączył: 26.10.2004

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


mam oto taki kod
  1. <script language="JavaScript">
  2. advAJAX.setDefaultParameters ({
  3. onSuccess : function(obj) {
  4. if (obj.responseText!="NO") {
  5.  
  6. alert("cos");
  7.  
  8. }
  9. }
  10. });
  11.  
  12.  
  13. function sprawdz() {advAJAX.get({ tag: "spr", url: "includes_bets/live_score_test.php" })}
  14. window.setInterval(sprawdz,10000);
  15.  



teraz zalezy mi by w miejsce funkcji alert("cos"); wstawic kolejne funkcje wykorzystującą advajax:

np.

function wynik() {advAJAX.get({ tag: "wynik", url: "includes_bets/wynik_live.php" })}
function podglad() {advAJAX.get({ tag: "kursy_live", url: "includes_bets/kursy_live.php" })};

już kombinowałem na różne sposoby, mam pytanie czy wogole sie tak da a jezeli tak to może jakas sugestia.

Za wszelkie info dzięki
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
grzegorz_g
post
Post #2





Grupa: Zarejestrowani
Postów: 259
Pomógł: 0
Dołączył: 26.10.2004

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


doprowadzilem kod do takiej postaci:

  1. <script language="JavaScript">
  2.  
  3. function time() {
  4. advAJAX.get({
  5. url: "includes_bets/time_live.php", tag: "time",
  6. onSuccess : function(obj) { document.getElementById(obj.tag).innerHTML = obj.responseText; }
  7. });
  8. }
  9.  
  10.  
  11. window.setInterval(time,1000);
  12.  
  13.  
  14.  
  15. function wynik() {
  16. advAJAX.get({
  17. url: "includes_bets/wynik_live.php", tag: "wynik",
  18. onSuccess : function(obj) { document.getElementById(obj.tag).innerHTML = obj.responseText; }
  19. });
  20. }
  21.  
  22. function podglad() {
  23. advAJAX.get({
  24. url: "includes_bets/kursy_live.php", tag: "kursy_live",
  25. onSuccess : function(obj) { document.getElementById(obj.tag).innerHTML = obj.responseText; }
  26. });
  27. }
  28.  
  29. function akcja1() {
  30. advAJAX.get({
  31. url: "includes_bets/akcja_live.php", tag: "akcja1",
  32. onSuccess : function(obj) { document.getElementById(obj.tag).innerHTML = obj.responseText; }
  33. });
  34. }
  35.  
  36.  
  37.  
  38. function sprawdz() {
  39.  
  40. advAJAX.get({
  41. url: "includes_bets/live_score_test.php", tag: "sprawdz",
  42. onSuccess : function(obj) {
  43.  
  44.  
  45.  
  46. alert(obj.responseText);
  47.  
  48. if (obj.responseText == "YES") {
  49.  
  50.  
  51.  
  52. wynik();
  53. podglad();
  54. akcja1();
  55.  
  56.  
  57. }
  58. }
  59. });
  60.  
  61. }
  62.  
  63.  
  64. window.setInterval(sprawdz(),10000);
  65.  



i to mi juz działa!! pojawiają się divy w zalezności co jest w <div id="sprawdz">. Jednak jak nie jest to w 100% o co mi chodzi chciałbym zachować to co jest w divach a tylko jak nastapi zmiana w <div id="sprawdz"> zaktualizować pozostałe

Ten post edytował grzegorz_g 14.03.2008, 00:19:01
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 6.10.2025 - 05:04