Php jQuery模态对话框-我一定错过了一件简单的事情
我有一个php页面需要模式确认 单击对话框上的“请确认”时,我希望页面帖子继续。我究竟怎样才能做到这一点 以下是我目前的js代码:Php jQuery模态对话框-我一定错过了一件简单的事情,php,jquery,Php,Jquery,我有一个php页面需要模式确认 单击对话框上的“请确认”时,我希望页面帖子继续。我究竟怎样才能做到这一点 以下是我目前的js代码: $(document).ready(function() { var $dialog = $('<div></div>') .dialog({ autoOpen: false, title: 'Are you sure?', modal: t
$(document).ready(function() {
var $dialog = $('<div></div>')
.dialog({
autoOpen: false,
title: 'Are you sure?',
modal: true,
closeOnEscape: true,
buttons: {
"Please confirm": function() {
// want to continue the post that was interrupted
// by this dialog
$("#account_mgr").submit();
$( this ).dialog( "close" );
},
Cancel: function() {
$( this ).dialog( "close" );
window.location = "/account_mgr#MySubscription";
}
}
});
// $('#btnSubscription').click(function() {
$('#btnSubscription').live('click', function() {
$dialog.dialog('open');
return false;
});
});
$(文档).ready(函数(){
变量$dialog=$('')
.对话({
自动打开:错误,
标题:“你确定吗?”,
莫代尔:是的,
closeOnEscape:没错,
按钮:{
“请确认”:函数(){
//要继续被中断的帖子吗
//通过此对话框
$(“#账户经理”).submit();
$(此).dialog(“关闭”);
},
取消:函数(){
$(此).dialog(“关闭”);
window.location=“/account_mgr#MySubscription”;
}
}
});
//$('#btnSubscription')。单击(函数(){
$('btnSubscription').live('click',function(){
$dialog.dialog('open');
返回false;
});
});
假设按钮以其他方式发布表单,则只需提交表单
buttons: {
"Please confirm": function() {
$( this ).dialog( "close" );
$('#btnSubscription').parents('form').submit();
},
Cancel: function() {
$( this ).dialog( "close" );
window.location = "/account_mgr#MySubscription";
}
}
一开始就不要发布。在对话框中返回true/false,如果为true,则只发布。好的,我现在发现我错过了做同样事情的代码。我认为你的代码不起作用了?你能发布表单标签吗?嗨,马特,我想你很接近了。表单提交了,我看到了我的发布数据,除了按钮。:-/我需要屁股我的表单标签:form action=“”method=“post”accept charset=“utf-8”class=“center\u form”name=“account\u mgr”id=“account\u mgr”>我的按钮:表单使用jQuery选项卡。共有4个选项卡,每个选项卡div都有一个按钮名称=“btnSubmit”,但id不同。jQuery选项卡可以很好地处理此问题。可能多个同名按钮不好?我发现,如果我进行以下更改,我可以在post数据中看到该按钮:$('btnSubscription')。live('submit',function(),而不是$('btnSubscription')。live('click',function()。但是,对话框不会弹出:-/