我打開對話框onclick按鈕,如果我點擊了多次,然後對話框打開兩次。我不想要最上面的小對話框出現,我只需要對話框後面。 在兩個對話框中都顯示相同的數據。 見圖片附UI對話框打開多次
我使用下面的代碼
$(document).ready(function() {
$("#policyDialog").html("");
$('#policyDialog').dialog({
autoOpen: false,
});
});
function onViewDetails(policyID) {
var policyID = policyID;
var policydetaildialog = "";
var title = "title";
$(".loading").css({
'display': 'block'
});
$('#policyDialog').dialog({
width: 1000,
autoResize: false,
draggable: false,
hide: null,
modal: true,
height: "auto",
maxHeight: 500,
maxWidth: 1000,
minHeight: 450,
minWidth: 450,
title: title,
close: function (e) {
//e.preventDefault();
}
});
$.ajax({
type: 'POST',
url: "xyz.jsp",
data: {
dataID: policyID
},
success: function (response) {
//$("#policyDialog").html(response);
policydetaildialog = response;
$("#policyDialog").dialog('open');
//$("#policyDialog").html(policydetaildialog);
$("#policyDialog").html(response);
},
dataType: "html",
async: false
});
/* $("#policyDialog").dialog('open');
$("#policyDialog").html(policydetaildialog);
return false; */
//$("#policyDialog");
//$('#viewDetail').prop('disabled', true);
}
我呼籲低於
<button type="button" class="btn" id="viewDetail" onclick="onViewDetails('<%=policy.getPolicyId()%>');">View details</button>
這個功能以下是我的html
<div id="policyDialog"></div>
也在下面檢查截圖:
請發表相關html請 – Banana 2014-10-07 10:53:27
刪除$('#policyDi alog')。dialog({autoOpen:false,});從document.ready – 2014-10-07 11:00:58