当用户点击按钮时,我正在将一个单独的URL加载到我页面上的DIV中。发生这种情况时,下次我的页面需要回发时,回发将转到我在DIV中加载的单独URL。
为什么会发生这种情况,如何阻止它回发到其他页面?
以下是步骤:
一些示例代码:
当用户点击按钮
时$('#anchorViewResourceCalendar').unbind('click');
$('#anchorViewResourceCalendar').click(function (e) {
e.preventDefault();
var webUserID = $('select.ddlResource').val();
var date = $('select.ddlMonth').val();
if (webUserID > 0) {
var calendarContainer = $('#divResourceCalendarContentContainer');
calendarContainer.html('<div>Please wait...</div>');
$('#divResourceCalendarContainer').dialog('open');
calendarContainer.load('../ViewUserCalendar.aspx?ViewWebUserID=' + webUserID + '&Date=' + date);
}
});
// Code for when the dialog opens/closes (since I'm emptying out the containing div)
$('#divResourceCalendarContainer').dialog({
autoOpen: false,
width: '1050',
height: '850',
modal: true,
open: function () {
$(this).parent().appendTo(jQuery("form:first"));
$('.ui-widget-overlay').bind('click', function () {
$('#divResourceCalendarContainer').dialog('close');
})
},
close: function () {
$('#divResourceCalendarContentContainer').empty(); // this removes anything added by jQuery on the page so it's back to it's original state of when the page was initially loaded
}
});