[jQuery] Re: Looping ajax requests

2007-12-19 Thread Sam Sherlock
I'd like to say thanks to Michael too, for your informed perspective and advice - S On 19/12/2007, Ryura <[EMAIL PROTECTED]> wrote: > > > Thanks for all the responses everyone! I found an alternate solution > (probably proprietary to the situation I was in) but I'll look to use > Michael's metho

[jQuery] Re: Looping ajax requests

2007-12-19 Thread Ryura
Thanks for all the responses everyone! I found an alternate solution (probably proprietary to the situation I was in) but I'll look to use Michael's method in the future.

[jQuery] Re: Looping ajax requests

2007-12-19 Thread David Decraene
the alerting is because of the asynchronous callback: it only triggers success when it receives response from the server, and by that time i already equals 5 (already looped multiple times), I think. Why you do not get that last page beats me, try for (var i=1;i<6;i+ +) David Decraene http://ont

[jQuery] Re: Looping ajax requests

2007-12-19 Thread haur
may be ... http://example.com/?one=5740&two=4/page.html 2007/12/19, Ryura <[EMAIL PROTECTED]>: > > > Got a problem when looping ajax requests. I have probably made a > mistake somewhere but I can't find it. > > dt=5; > for (i=1;i<=dt;i++) { > $.ajax({ > type

[jQuery] Re: Looping ajax requests

2007-12-19 Thread Michael Geary
} }); })( i ); } } Either way, it does exactly the same thing as the first version with the named functions. BTW, when you hear about "closures", this is what they're talking about. -Mike _ From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On

[jQuery] Re: Looping ajax requests

2007-12-18 Thread Sam Sherlock
I'd say its a scope issue with the var i I am not a JS expert so this is not definitive var I = 0, dt = 5; for (i=1;i<=dt;i++) { I = i; $.ajax({ type: "GET", url: "http://example.com/5740/"+i+"/page.html";, dataType: "text", success: function(data){ alert(I); } })}; untested; I might eith