I have a simple ajax like this:
function ajax() {
$.ajax({
url: "../../api/utilitarios/cidades/estado",
method: 'POST',
dataType: 'json',
success: function (data) {
},
error: function (data) {
console.log(data);
}
});
}
It has a success and an error, I need to know when the ajax request has been completed and everything is ready to be printed?
Currently I use a setTimeout within the success, but if it takes more thanq this will bugar my script ....