Hey, I'm trying to grab a total amount of pages, and then grab the item_id's from each page. My code works but instead of each ajax request firing after the last one, they all run at once. How can I queue the calls so each call to get_page_items and then get_item is called 1 by 1.
function scraperFunction()
{
$.get('./scraper/get_total_pages', { type: 'movie' }, function(data)
{
total_pages = data;
total_items = total_pages * 6;
for(page=1;page<=total_pages;page++)
{
$.get('./scraper/get_page_items', { type: 'movie', page: page }, function(json)
{
$.each(json, function(key, item_id)
{
$.get('./scraper/get_item', { item_id: 'item_id' });
});
}, 'json');
}
});
}