我在 jQuery 对话中加载 html 页面,但是当我使用关闭按钮关闭对话并再次打开对话时,它会给出以下错误:
Error: cannot call methods on dialogue prior to initialization; attempted to call method 'isOpen'
我的代码
$("#enterRunnerPositionDialog").dialog({
autoOpen: false,
position: 'center',
title: 'Enter Runner Position Selection',
draggable: false,
width: 1000,
height: 900,
resizable: false,
modal: true,
open: function (event, ui) {
var html = "";
$.ajax({
type: "GET",
url: "AdminController",
data: {
overlayScreenNo: 25,
objectName: 'horseNo'
},
success: function (response) {
var parseJSON = eval('(' + response + ')');
var success = parseJSON.success;
var status = parseJSON.status;
if (success == true && status == 200) {
displayRunner(parseJSON.result);
} else {
//alert(parseJSON.msg);
}
}
});
}
$("#enterRunnerPositionButton").click(function () {
$("#enterRunnerPositionDialog").load('runnerPositionSelection.html', function () {
//$("#enterRunnerPositionDialog").dialog("open");
});
if ($("#enterRunnerPositionDialog").dialog("isOpen")) {} else $("#enterRunnerPositionDialog").dialog("open");
});