jquery - JavaScript runtime error: cannot call methods on dialog prior to initialization; attempted to call method 'close'" -
error running below code block: "0x800a139e - javascript runtime error: cannot call methods on dialog prior initialization; attempted call method 'close'". failing @ statement: $(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 sure want delete report:' + reporttitle + '?<br>this action cannot 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"); } }); }
Comments
Post a Comment