我與jQuery UI和MVC3試驗和我偶然發現了以下問題jQuery UI的彈出式內AJAX形式:問題與IE8
我有一個使用AJAX
<%: Ajax.ActionLink("Edit", "Edit", new { id = 1 }, new AjaxOptions() { UpdateTargetId = "dialog", OnSuccess = "DisplayPopup" }, null)%>
<div id="dialog" title="Location">
</div>
這是非常基本的網頁控制器的代碼:
public ActionResult Edit(int id)
{
return PartialView();
}
[HttpPost]
public ActionResult Edit()
{
return Content("Saved!");
}
和局部視圖編輯:
<b>whatever</b>
<% using (Ajax.BeginForm("Edit", "Home",
new AjaxOptions()
{
UpdateTargetId = "editForm",
HttpMethod = "POST"
}))
{%>
<div id="editForm">
<input type="submit" value="Save" />
</div>
<% } %>
上面的代碼工作正常。
現在我添加了jQuery UI彈出代碼:
<script type="text/javascript">
function DisplayPopup() {
$('#dialog').dialog('open');
}
$('#dialog').dialog({
autoOpen: false,
width: 600,
modal: true,
buttons: {
"Close": function() {
$(this).dialog("close");
}
}
});
</script>
後,在Firefox和Chrome能正常工作,而在IE8我看到了以下問題:
- 點擊編輯 - 讓AJAX調用Edit(int id)動作並顯示彈出窗口中的編輯視圖
- click save - 使AJAX調用Edit()並顯示文本「Saved!」
- 關閉彈出
- 點擊編輯 - AJAX調用編輯(INT ID) - 再次
- 點擊保存 - 這一次它充分回傳(僅適用於IE)
什麼想法?
謝謝!
我剛剛做了thickbox(http://jquery.com/demo/thickbox/)而不是jQuery UI彈出窗口,它在所有三種瀏覽器中工作正常...... – Slav 2010-11-14 16:37:45
看起來像可能存在jqueryUI的問題模式對話框 - 我在這裏提交了一個bug ticket http://bugs.jqueryui.com/ticket/6679 – Slav 2010-11-21 17:52:42
嘗試銷燬close事件上的對話框並在displaypopup函數中每次創建對話框new – jnoreiga 2011-03-14 16:43:19