我在 jQuery 中加载页面Dialog
。ajax 命令完成后,我希望能够在 jQuery 中重新加载同一页面Dialog
。如何Dialog
从加载的页面中重新加载 jQuery Dialog
?
父页面(Blah.aspx):
<script type="text/javascript">
function view_dialog() {
$('#dialog').load('blah2.aspx').dialog({
title: 'test' ,
modal: 'true',
width: '80%',
height: '740',
position: 'center',
show: 'scale',
hide: 'scale',
cache: false });
}
</script>
<asp:Content
ID="Content2"
ContentPlaceHolderID="ContentPlaceHolder1"
runat="server">
<input id="Button1" onclick="view_dialog()" type="button" value="button" />
<div id="dialog" style="display: none"></div>
</asp:Content>
对话框内容页面(blah2.aspx):
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script type="text/javascript">
$(document).ready(function() {
function doit() {
var request = $.ajax({
url: "someurl",
dataType: "JSON",
data: {
a: 'somevalue'
}
});
request.done(function () {
//refresh the current dialog by calling blah2.aspx again
});
}
</script>
<asp:Content
ID="Content2"
ContentPlaceHolderID="ContentPlaceHolder1"
runat="server">
<input id="Button1" onclick="doit()" type="button" value="button" />
</asp:Content>