I'm writing a little script that makes individual AJAX calls through a loop and I came across a, most likely obvious, problem. It seems that the loop is going to fast to handle the data that is received with ajax, causing it to only load the last piece of data in the loop. I added an alert box that steps through the iterations and that loads the data fine, but it wouldn't be practical in a user environment. The code is simply a jquery .post() with a callback inside a for-loop. I can post code upon request, but I feel like this can be cleared up verbally. Any one know a workaround or better approach to loading data sequentially?
EDIT
Does .ajaxSetup()
modify .post()
? Perhaps I can use that to change the async value for .post()..
.post()
is just shorthand for.ajax({ type: 'POST', url: url, data: data, success: success dataType: dataType })
– Abeyant