On load event I am calling an ajax get method withing a loop. But while this loop does not end, my ajax call from a click event is not called. The click event is triggered, but not the ajax method. It is only called after the loop is finished. How to overcome this scenario?
$(document).ready(function () {
$.each($(".saldo-load"), function (i, x) {
$.ajax({
datatype: "json",
type: "get",
url: "/revendedor/myMethod/",
success: function (data) {
console.log('loop');
console.log(data)
}
});
});
});
function myCLick() {
$.ajax({
datatype: "json",
type: "get",
url: "/revendedor/myMethod",
success: function (data) {
console.log('click');
console.log(data)
}
});
}