0
我正在使用MVC 3的Ajax表單這是我的看法:攔截阿賈克斯partialview在MVC 3形式
<div id="form_container">
@{ Html.RenderPartial("_FormPartial"); }
</div>
這是形式的局部視圖:
using (Ajax.BeginForm("Register", "Account", new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "form_container", LoadingElementId = "loading", OnBegin = "animate" }))
{...code...}
我的「當出現錯誤時,在我的「帳戶」控制器上註冊「操作將返回相同的部分視圖。但表單提交時正確我用另一個局部視圖替換形式partialview像這樣:
<h1>Success!<h1>
我希望<h1>
由jQuery的攔截,並用fadeIn()
呈現。 document.ready()
既不工作也不工作,因爲它的局部視圖不再存在,所以在ajax表單上的OnCompleted
/OnSuccess
屬性也不起作用。
達到此目的的最佳方法是什麼?
原來我其實可以使用的onSuccess。你提供的成功函數並沒有被使用,因爲它只是:function success(){$(「h1」)。hide()。fadeIn(「slow」);} – vascop