Reputation: 8336
I have a situation where I need to make sequential AJAX requests represented by an ordered list (<ol><li>..
) on the page. I use jQuery.
Requirements:
What I have working:
$.getJSON
call to the desired URL for each list itemThe 'Requirements' items are the pieces I haven't worked out.
SOLUTION
I ended up using jQuery Message Queuing, but I didn't find a way to return HTTP errors to the item that spawned the request. I instead display an error in a different place.
$(document).ajaxError(function(event, response, settings, exception){
$('#Admin').append('<p class="error">' + response.status + ' error requesting page:<br />' + settings.url + '<br />Reload this page to continue.</p>');
});
I would prefer to display HTTP errors with the item if anyone can help me with that.
Upvotes: 1
Views: 607
Reputation: 7993
There can be possibly two ways:-
Hope it helps.
Upvotes: 1
Reputation: 95578
jQuery Message Queuing is what you might be looking for. It performs serial (sequential) AJAX requests.
You can view a demo here.
Upvotes: 1