Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Jquery - odświeżanie div'a
Kemsan
post 13.10.2008, 13:20:41
Post #1





Grupa: Zarejestrowani
Postów: 33
Pomógł: 6
Dołączył: 30.06.2008
Skąd: Bytom

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


Jak zrobić doświeżania div'a w jquery?
W mintAjax wyglądało to tak:
Kod
function refresh() {
var req = mint.Request();
req.OnSuccess = function () { document.getElementById("mapa").innerHTML = this.responseText;},
req.OnError = function () {document.getElementById("mapa").innerHTML = "Wystąpił błąd !! </br>" + this.responseText + "</br>" + req.xmlHttpRequest.statusText;}
req.Send ("moduly/mapa.php");
}
var ginter=setInterval(refresh, 1000);

Przerzuciłem się na jQuery(według opini frameworków js) i nie wiem jak to przerobić na jquery...
Proszę o pomoc :)

Ten post edytował Kemsan 14.10.2008, 06:50:20
Go to the top of the page
+Quote Post
zzeus
post 13.10.2008, 20:32:40
Post #2





Grupa: Zarejestrowani
Postów: 441
Pomógł: 71
Dołączył: 3.09.2007
Skąd: wrocław

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


Zmiast

Kod
function () { document.getElementById("mapa").innerHTML = this.responseText;


wpisz

Kod
$("#mapa").text(this.responseText);


powinno działać smile.gif

Ten post edytował zzeus 13.10.2008, 20:33:03


--------------------
Go to the top of the page
+Quote Post
Kemsan
post 14.10.2008, 06:47:25
Post #3





Grupa: Zarejestrowani
Postów: 33
Pomógł: 6
Dołączył: 30.06.2008
Skąd: Bytom

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


A co z
Kod
var req = mint.Request();
?
Go to the top of the page
+Quote Post
zzeus
post 14.10.2008, 09:41:39
Post #4





Grupa: Zarejestrowani
Postów: 441
Pomógł: 71
Dołączył: 3.09.2007
Skąd: wrocław

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


Myślałem że chodzi Ci o zmianę zawartości samego div'a. Jak chodzi o resztę to wszystko jest tutaj napisane - http://docs.jquery.com/Ajax


--------------------
Go to the top of the page
+Quote Post
batman
post 14.10.2008, 09:44:50
Post #5





Grupa: Moderatorzy
Postów: 2 921
Pomógł: 269
Dołączył: 11.08.2005
Skąd: 127.0.0.1




Jeśli chcesz tylko podmieniać zawartość diva, to wystarczy użyć funkcji load. Ale jeśli chcesz czegoś więcej (obsługa różnych momentów połączenia, różne rodzaje odbieranych danych), to musisz użyć funkcji ajax.


--------------------
I would love to change the world, but they won't give me the source code.
My software never has bugs. It just develops random features.
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: 22.06.2025 - 08:54