javascript - jQuery confirm alerts arent shown
问题描述
Im using jquery-confirm libray from this site: https://craftpip.github.io/jquery-confirm/
im trying to customize all my warnings and insertion confirms but the execution is entering in ajax call and jquery-confirm function so the alert is showing for miliseconds because the execution continues and dont stop at the alert. Here is some code, this is ajax code:
$.ajax({
type:"POST",
url : '/proyecto/Api',
data : { action: 'addConcesionario', auth_token: auth_token, usuario_sesion: usuario, nomConcesionario: nomConcesionario.value, nifConcesionario: nifConcesionario.value, nomCiudad: nomCiudad.value, nomAdministrador: nomAdministrador.value, cpConcesionario: cpConcesionario.value, telefono: telefono.value, direccion:direccion.value},
success : function(response) {
mensajePopup( 1,"/proyecto/administracion/administracion.jsp","Insertion successful","", "green")
window.location.href = "/proyecto/administracion/administracion.jsp";
}, error: function(result) {
alert("ERROR");
}
});
Here is jQuery-confirm alert code:
function mensajePopup( tipoPopup,ruta,titulo,mensaje, color ){
valor = false;
if(color==""){color="green";}
if(ruta==""){ruta="/proyecto/administracion/administracion.jsp";}
switch (tipoPopup){
case 1: //Aviso generico
$.confirm({
title: titulo,
content: mensaje,
type: color,
buttons: {
Aceptar: function(){
window.location.href = ruta;
}
}
});
I have tried removing window.location.href but it reload the form and gets stuck there without showing anything.
thanks in advance!
解决方案
推荐阅读
- python - Python中的多线程回归
- docker - 如何停止docker内部正在运行的应用程序?
- join - 关于 KStream 在 kafka 流中加入 KTable
- r - 版本升级后使用 libPaths 更改自定义默认 R 库?
- go - 作业中的 {} 是什么?
- python - Golang 的 TLE (Time Limit Exceeded) 错误,但使用类似逻辑的 Python 没有。但为什么?
- java - 为什么我收到错误 = 2 ProcessBuilder 没有这样的文件或目录
- html - 容器-流体和容器在一排内
- javascript - 当我遍历填充的数组时,为什么我的 HTML 不显示?
- android - cordova.plugins.diagnostic 不适用于新创建的应用程序