如何在 js 函数中调用模态而不点击模态按钮?
if (email != "") {
$.ajax({
type: "POST",
url: "ajax/email.php",
data: 'email='+ email,
cache: false,
success: function(result){
//alert(result);
if (result == 'true') {
$.ajax({
//do some thing
});
}
else {
$("#sendemail").modal('show');
// there is no button for modal
return false ;
}
}
});
}
现在,在其他情况下,模式不会打开,它位于另一个文件中。
最佳答案
您忘记用花括号关闭成功函数。
if (email != "") {
$.ajax({
type: "POST",
url: "ajax/email.php",
data: 'email='+ email,
cache: false,
success: function(result){
//alert(result);
if (result == 'true') {
$.ajax({
//do some thing
});
}
else {
$("#sendemail").modal('show');
return false ;
}
} // no syntex error
});
}
关于javascript - 如何在 js 函数中调用模态而不单击模态按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26669359/