I have an ajax call (post, async) executed on the opening event of a modal. I have a click event on a button inside that modal that launch an ajax call (post, async). When I click my button, its ajax call won't be done until the first one is done. How can I make both calls to run simultaneously?
Here is a sample of code:
$.ajax({ // On modal opening
type: "POST",
data: myData,
success: function(response) {
/*some code*/
},
async: true,
url: url
});
$(document).on('click', '#myButton', function(e){
$.ajax({
type: "POST",
data: myOtherData,
success: function(response) {
/*some code*/
},
async: true,
url: url
});
});