sg

Cumartesi, Kasım 26, 2005

Catching multiple XMLHttpRequests


I built a map that indexes 7000 photos,
http://www.kayaker.net/php/tstimage.html, and I'm using AJAX to
request new markers every time the map zooms or 'moveend's. This works
fine most of the time but occasionally my code pops up an alert about
an unexpected combination of .readyState and .status. Even more often I
get an error about the variable containing the XMLHttpRequest being
undefined. This last error isn't so bad since I can ignore it and
figure on the next zoom or move requesting the lost markers.
I suspect that the problem is caused by the fact that I declare the
variable that contains the XMLHttpRequest as a single global, and
multiple requests are colliding. However, I don't have enough JS
experience to figure out how to fix this. I tried declaring this
variable inside the routine that creates the XMLHttpRequest and sending
the value to the processing routine with something like this:
req.onreadystatechange = function() {processReqChange(req);};
But this only made the req variable undefined all the time!
Any suggestions or pointers to code that does this correctly?

0 Comments:

Yorum Gönder

<< Home


Komik Videolar   islam  şarkı sözleri  yemek tarifleri  gelibolu  huzur   sağlık