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: "GET",
  url: "http://example.com/5740/"+i+"/page.html";,
  dataType: "text",
  success: function(data){
  alert(i);
}
})};
This alerts "5" 4 times. Interestingly, it correctly gets 4 pages:
http://example.com/5740/1/page.html
http://example.com/5740/2/page.html
http://example.com/5740/3/page.html
http://example.com/5740/4/page.html

What is the solution?
Thanks,
Ryura

Reply via email to