继续调用方法错误,不知道还有什么可以尝试。我有这个在另一个程序中工作,但不在ajax函数内。我试过靠近'关闭',“关闭”,但仍然没有运气。当用户在对话框模式外单击它将关闭当前打开模态时尝试创建它。
function viewForm(record_id) {
$.ajax({
type: "POST",
url: "/info_notifications/fetch_pending_changes",
data: "_unique_id=" + record_id,
success: function (msg) {
document.getElementById('dialog').innerHTML = msg;
var closedialog;
function overlayclickclose() {
if (closedialog) {
$('#dialog').dialog('close'); //<--this is the method its attempting to call
}
//set to one because click on dialog box sets to zero
closedialog = 1;
}
$('#open').click(function () {
$('#dialog').dialog("open");
closedialog = 0;
});
$("#dialog").dialog({
resizable: true,
width: 'auto',
height: 'auto',
open: function () {
closedialog = 1;
$(document).bind('click', overlayclickclose);
},
focus: function () {
closedialog = 0;
},
close: function () {
$(document).unbind('click');
},
closeText: "Close",
buttons: {
"Update": function () {
$.ajax({
type: "POST",
url: "/info_notifications/update_notification",
data: "_unique_id=" + record_id,
success: function (msg) {
$(document).ajaxStop(function () {
location.reload(true);
});
}
});
},
"Approve": function () {
$.ajax({
type: "POST",
url: "/info_notifications/approve_request",
data: "_unique_id=" + record_id + "&status=approve",
success: function (msg) {
$(document).ajaxStop(function () {
location.reload(true);
});
}
});
},
"Deny": function () {
$.ajax({
type: "POST",
url: "/info_notifications/approve_request",
data: "_unique_id=" + record_id + "&status=deny",
success: function (msg) {
$(document).ajaxStop(function () {
location.reload(true);
});
}
});
},
"Cancel": function () {
click: $(this).dialog("close");
}
},
close: function () {
$(document).unbind('click');
}
});
}
});
var closedialog;
function overlayclickclose() {
if (closedialog) {
$('#dialog').dialog('close'); //<--this is the method its attempting to call
}
//set to one because click on dialog box sets to zero
closedialog = 1;
}
}