Hey,
Struggling massively on this one, I'm trying to do the following:
1. Request to server that returns a number (total amount of pages).
2. Run a for loop on the total number of pages, foreach page run an ajax request that returns a JSON string of item id's.
3. Foreach item id make a request to the server.
Essentially something like this..
The problem is they run all at once, and I've been told using async: false is a bad idea and locks up the browser. I've had a go at using this and this.Code:$.get('total_amount_of_pages', function(total_pages) { for(page=1;page<=total_pages;page++) { $.get('page_items', { page: page }, function(json) { $.each(json, function(key, item_id) { $.get('get_item', { item_id: item_id }); }); } } });
The first link I managed to almost get it working, but I have a feeling it doesn't fully support nested calls, because the page_item calls would be queued, but the get_item calls weren't.
I've been struggling on this for a while now and would appreciate any help.
Thanks!


Reply With Quote

Bookmarks