tengo una función a la cual le envío dos variables que al llamarla necesito hacer un Delay
.
El código de cuando la llamo es:
$(document).ready(function(){
$('#FormAplicaCan').on('submit', function(e) {
e.preventDefault();
$.ajax({
url:'../phpAux/ProcesoAplicaCan.php',
type:'POST',
data:$(FormAplicaCan).serialize(),
beforeSend: function () {
$("#RespuestaAplicacion").html('<i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>Aplicando , espere por favor.');
},
dataType: "JSON",
success: function (resp) {
if (resp.Registro < 1){
//alert( "No pudo Cargarlo" );
$("#RespuestaAplicacion").html(resp.Mensaje);
$("#RespuestaAplicacion").addClass('alert alert-warning');
$("#RespuestaAplicacion").show();
$("#RespuestaAplicacion").delay(8000).hide(600);
} else {
$("#RespuestaAplicacion").html(resp.Mensaje);
$("#RespuestaAplicacion").addClass("alert alert-success");
$("#RespuestaAplicacion").show();
$("#RespuestaAplicacion").delay(8000).hide(600);
$('#myModalAplicaCan').delay(8000).modal('toggle');
setTimeout(listarS(resp.listando,resp.aPuesto)),8000;
}
}
})
})
});
La funcion se ejecuta directamente sin esperar los 8 segundos...
Tambien utilicé:
listarS(resp.listando,resp.aPuesto).delay(8000);
Tampoco funciono Cómo debo hacerlo?