不断收到调用方法错误,不知道还能尝试什么。我有这个在另一个程序中工作,但不在 ajax 函数中。我试过把'close','close'关闭,但仍然没有运气。试图在用户单击对话框模式外部时关闭当前打开的模式。
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;
}
}