[英]jquery submit doesn't submit
The dialogue box parts of this script work but the form doesn't submit 该脚本的对话框部分可以工作,但表单未提交
$(document).ready(function(){
$("form#audit_delete_form").submit(function(e) {
e.preventDefault();
var $form = $(this);
if ($form.find('select[name="audit_id_select"]').val() == "") {
$.msgbox("Please select an audit", {
type:"alert",
buttons: [
{type: "submit", value: "OK"}
]
});
}else{
$.msgbox("Are you sure you want to permanently delete this audit?", {
type: "confirm",
buttons : [
{type: "submit", value: "Yes"},
{type: "submit", value: "No"},
{type: "cancel", value: "Cancel"}
]
}, function(result){
if(result == 'Yes'){
$(this).submit()
}
});
}
});
});
Try using e.preventDefault();
尝试使用
e.preventDefault();
anyway. 无论如何。 Then issue the submit if the user confirms.
如果用户确认,则发出提交。
$(THE_SUBMIT_BUTTON_ID).click(function(e){
e.preventDefault();
if(...){...}
else{
$.msgbox("Are you sure you want to permanently delete this audit?", {
type: "confirm",
buttons : [
{type: "submit", value: "Yes"},
{type: "submit", value: "No"},
{type: "cancel", value: "Cancel"}
]
}, function(result){
if(result == 'Yes'){
$("form#audit_delete_form").submit() // We only submit when prompted
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.