我試圖在Umbraco 5(木星)上實現AJAX,我試圖創建Surface控制器,它與普通回發很好地工作,但它不提供使用Mvc Ajax控件,例如Ajax.BeginForm等等,現在我已經在應用程序中添加了一個新的MVC區域,我可以通過Ajax表單輕鬆地將Post Back發送到Controller的Action,但是我應該從這個Action返回什麼,因爲CurrentUmbracoPage不可訪問(因爲它不是地面控制器),我的代碼是相當簡單的,Umbraco 5通過添加新的MVC區域實現Ajax
@using (Ajax.BeginForm("HandleFollowsUs", "propertyDetails", new AjaxOptions { InsertionMode = InsertionMode.Replace, HttpMethod = "POST", LoadingElementId = "ajax-loader", UpdateTargetId = "fuError" }))
{
<input type="image" style="border-width: 0px;" src="/images/btnSubmitN.jpg" id="btn_submitEmail" /></span>
}
AND my ACTION is
[HttpPost]
public ActionResult HandleFollowsUs(FormCollection collection) {
//Do Something
Return View();//////This is where i am confused.
}
如果我返回查看,它是不是在新的區域,局部視圖將只返回頁面的位部分,:/ 任何幫助將不勝感激, 謝謝, 謝爾
感謝您的答覆sebastiaan,我不想做一個客戶端驗證,我想用戶提交他的電子郵件,因此他可以跟隨我們的通訊, 其實我正在做這一切,因爲你的包(木星作爲Visual Studio應用程序),它工作得很好,感謝一百萬,我也通過使用jquery ajax解決了這個問題。 – Sher 2012-04-07 10:20:16
不客氣。會提出簡單的jQuery,但我看到你已經修復它,做得很好! – sebastiaan 2012-04-07 13:05:33