我编写了一个代码来打开一个页面作为模态弹出窗口。它工作正常。但是当页面作为对话框打开时,我点击打开页面的asp按钮,它会导致页面在窗口中生成...父页面消失...我如何解决问题,以便我做回发在弹出页面中,它也应该保留为主页面中的弹出窗口。
当我点击Payment_Delivery_Scheduling.aspx中的按钮时,它会导致页面在浏览器中重定向到该页面。
function openPaymentAndDeliveryModel(id) {
var windowWidth = $(window).width() / 1.25;
var windowHeight = $(window).height() /1.5;
$('#popup').load("Payment_Delivery_Scheduling.aspx?id=" + id + "", function () {
});
$('#popup').dialog({ modal: true, height: windowHeight, width: windowWidth });
}
答案 0 :(得分:0)
Hey Sachin示例代码是
$("#btnSubmit").live("click", function (e) {
if ($('#txtPwd').val().length < 1) {
$('#lblResponse').text('Please enter password to move ahead.').addClass("fail-message"); ;
$('#txtPwd').focus();
} else {
callAjax($('#txtPwd').val());
e.preventDefault();
}
});
function callAjax(hashVal) {
var address = "Home.aspx";
$.ajax({
type: 'POST',
url: address,
data: { pwd: hashVal },
beforeSend: function () {
// this is where we append a loading image
$('#ajax-panel').html('<div class="loading"><img src="images/loading.gif" alt="Loading..." /></div>');
},
success: function (data) {
// successful request; do something with the data
$('#ajax-panel').empty();
var actualData = data.trim().split('~');
$("#lblResponse").html(actualData[0]);
$('#txtPwd').val('');
if (actualData[1] == "true") {
window.location.href = window.referer = $('#lnkMyCorner').attr('href');
}
},
error: function () {
// failed request; give feedback to user
$('#ajax-panel').html('<p class="error"><strong>Oops!</strong> Try that again in a few moments.</p>');
}
});
}
希望它能帮助你