Hi vorp, your English is fine, don't worry about that. :-) I'm trying to understand the purpose of your code, though. Why do you want to fire off 50 Ajax requests all at once like that?
Also, these Ajax requests are *asynchronous*. That is, $.ajax() returns immediately without waiting for the response from the server. So it's almost certain that the responseText property of the XMLHttpRequest object does not yet have a value. Instead of testing the return value from $.ajax(), you need give it a success callback. This function will be called when the Ajax request receives a response from the server. Could you explain what it is you want to accomplish here, and then we could talk about the best way to code it? Whatever it is, you can probably do it with a single Ajax request instead of 50 of them. -Mike > From: vorp > > Hi, I try get some results from ajax using while loop, but it > doesn't work in IE7 and Safari. > > Here's example code: > > function get_results(foo){ > return $.ajax({ > type: "GET", > url: "some_url.php/"+foo, > dataType: "json" > }).responseText; > }; > > ... > ... > var result = 0; > var i = 0; > while(result==0 && i<=49){ > result = get_results(i); > i++; > } > ... > > Although it works fine in Firefox and Opera (in firebug I can > see every single request), but in IE and Safari not. Those > browsers not responding after run this code. What's wrong and > how can I fix it ? > > Regards > > ps.sorry for my poor english ;) > >