我在jQuery Dialog
中加載頁面。 ajax命令完成後,我希望能夠重新加載jQuery Dialog
中的同一頁面。如何從Dialog
中加載的頁面內重新加載jQuery Dialog
?如何從對話框中重新加載jQuery對話框?
父頁(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>
謝謝!我知道這已經過了4年,但是你的代碼非常幫助我! – Markoh