I am in a situation where I need to create a table using multiple AJAX Calls. I make an ajax request and get a JSON object with an array of elements (lets say 5). Run it through a for loop and at response of each ajax request create a row using parts of data from current looped element and current ajax call, then add it into a row to the table. (sorry for my bad grammar)
I would like to know how would I implement this using deferred objects? If my understanding is correct, this should be more simple to implement using deferred object? Correct?
My current implementation
$.ajax{
//options
success : function(data){
// add col1, col2, col3 from first ajax call
$(data).each(function(i,e){
// make ajax request based on inputs from current loop element
$.ajax({
//options
success: function(data) {
// add col5, col6 from first ajax call
// add col7, col8 from current loop element
// add <tr> to the table
}
});
});
}
}