最近遇到利用mvc開發的jquery mobile程式在sumbit或點選連結之後

無法執行form ready 或 init 的js程式碼

原因出在jquery mobile的ajax效果

目前找到的解決方法是將form sumbit或link加上data-ajax=flase的屬性

link 的語法參考如下:

<li>@Html.ActionLink("連結名稱", "VeiwName", "ControlName", null , new Dictionary<string, Object> { { "data-ajax", "false" } })</li>

form submit 的語法參考如下:

 @using (Html.BeginForm("VeiwName", "ControlName",
                 new RouteValueDictionary { { "ReturnUrl", ViewBag.ReturnUrl } },
                 FormMethod.Post, new Dictionary<string, Object> { { "data-ajax", "false" } })) {

arrow
arrow
    文章標籤
    jquerymobile mvc
    全站熱搜

    湯瑪的吳 發表在 痞客邦 留言(0) 人氣()