错误我运行下面的代码块:“0x800a139e - JavaScript运行时错误:在初始化之前无法调用对话框上的方法;尝试调用方法'close'”。 在声明中失败:$(this).dialog(“close”);
function DeleteReport(reportTitle, reportId) {
reportIdToDelete = reportId;
var buttons = [
'<button id="btnYes" class="modalbtn" onclick="ConfirmDeleteReport();">Yes</button>',
'<button id="btnNo" class="modalbtn" onclick="$.modal.close();">No</button>'
];
ShowMessage('Are you sure you want to delete Report:' + reportTitle + '?<br>This action cannot be undone.', '', buttons);
}
function ConfirmDeleteReport() {
$.ajax({
url: "/Report/DeleteReport",
data: { reportId: reportIdToDelete },
type: 'Get',
success: function (data) {
if (data.codeResult == 1) {
$(this).dialog("close");
window.location.reload(true);
}
else {
ShowMessage(data["message"], "");
}
},
error: function (request, status, error) {
ShowMessage("Error while proccessing ..", "Error, Report Not Deleted");
}
});
}