これが私のシナリオです。
モーダル ダイアログにフォームを表示する ajax 機能を使用して、jqModal を呼び出します。ユーザーがいくつかの情報を入力してフォームを送信すると、応答として HTML が返されます。
結果のhtmlはjqModal div内に表示されています。次に、ユーザーは [閉じる] をクリックして、モーダル ダイアログを閉じます。
これまでのところ、これはすべて正しく機能しています。
代わりに、送信時にダイアログを閉じ、サーバーからの応答で div を更新します。
呼び出しコード:
<script type="text/javascript">
$(document).ready(function () {
$('#jqmWindowContainer').jqm({
modal: true,
ajax: '.... url to display my form ...',
onHide: myAddClose,
ajaxText: 'Loading',
toTop: true,
});
function myAddClose(hash) {
hash.w.fadeOut('300', function () { hash.o.remove(); });
}
});
</script>
ページのマークアップを呼び出します。[この検索を保存] をクリックすると、ダイアログが表示されます。
<a href="#" class="jqModal">Save this search</a>
<span id="jqmWindowContainer" class="jqmWindow"></span>
表示されるフォーム:
<div class="jqmPopupForm" id="jqmPopupForm">
<div id="loadingMessage" style="display: none;">
Saving...
</div>
<% using (Ajax.BeginForm("Save", "AssetSearch",
new AjaxOptions()
{ HttpMethod = "Post", InsertionMode = InsertionMode.Replace,
UpdateTargetId = "jqmPopupForm",
LoadingElementId = "loadingMessage"
}))
{%>
.... some html input elements go here ...
<input type="submit" value="Save Search" />
<a class="jqmClose" href="#">Cancel</a>
<%
}%>
</div>
現在、jqmPopupForm div 全体がフォーム送信の結果に置き換えられています。
ユーザーにダイアログを閉じさせる代わりに、ダイアログを閉じてページの div を更新するにはどうすればよいですか?