-1
have this code below. When the user finishes the form he closes the class modal ". esqFecha". and opens the loading modal. However, the "esqfecha" modal only closes when the message is sent and the "loading" modal closes before the "esqFecha" modal. How could I do to the modal "loading" close after the modal "esqFecha" receive the message
$("#formEsq").on("submit", function (event) {
event.preventDefault();
$("#loadMe").modal({
backdrop: "static", //remove ability to close modal with click
keyboard: false, //remove option to close with keyboard
show: true //Display loader!
});
setTimeout(function () {
$("#loadMe").modal("hide");}, 3500);
var enderecoesq = jQuery('.enderecoesq').attr("data-enderecoesq");
console.log(enderecoesq);
$.ajax({
method: "POST",
url: enderecoesq,
data: new FormData(this),
contentType: false,
processData: false,
success: function (retorna) {
if (retorna['erro']) {
$('#msgEsq').html(retorna['msg']);
$('#msgCad').html(retorna['msg']);
$('.esqFecha').modal('hide');
$('#loginModal').modal('show');
} else {
$('#msgEsq').html(retorna['msg']);
}
}
});
What would be "modal receive the message"? You should not use the callback
beforeSend
to display the loading?– Woss
when he finishes the registration in the database he returns the registered message and then closes the modal and goes to login. or registered keeps in modal,
– cahm