I need to use more than 1 json from many URL API. For each URL I will do different thing but it has to be a the same time. I will populate some headers of a table with 1 URL, and the info of the table with 2 or 3 URL.
I have something like this:
$(document).ready(function(){
$("#my_button").click(function(){
var urlOne = 'http://example1',
var urlTwo = 'http://example2'
$.ajax({
url: urlOne,
success: function(result){
console.log(result);
$('#some_div').hide();
$('#another_div').show();
$('.some_class').append(result[0].some_data);
etc...
},
error: function (exception) {
$('#modal_error').modal('show');
}
});
$.ajax({
url: urlTwo,
success: function(result){
$('#myTabContent').show();
populateHeaders($("#headers"),result);
etc...
}
});
//And maybe more ajax calls.
});
});
How can accomplish that?