0
我使用C#中的MVC的Web應用程序。一切正常,直到我執行「保存」操作。此操作jQuery的不工作,直到擊中刷新頁面
從頁面讀取數據
即
x = $("#mytextbox").val();
x是始終加載頁面時所填寫的初始值。它在加載頁面後不返回用戶鍵值。我也注意到這個SAVE函數中的jQuery確實執行了jQuery show/hide ex:
$("#messagebox").show(); -- to show the user the feedback for the save action.
現在。如果我點擊F5或刷新頁面。所有上述工作正常。
難道是HTML元素我添加到div是不是在DOM?
的代碼塊是在我的.ascx(局部視圖)
<script language="javascript" type="text/javascript">
$("#save-button").button(); -- Works
$("#status-button").button(); -- Works
$("#DateField").datepicker(); --Works
alert($("#DebugtextBox").val()); --Works
$("#DebugtextBox").val("test"); -- Works but does not update the val in the html page
alert($("#DebugtextBox").val()); -- Works and shows "TESTS" in the alert. But the field in html page still shows the original val.
//上面..此
你將不得不向我們展示,演示了這個問題一個簡單的例子。顯然,這不是大多數MVC應用程序的工作方式。另外,哪個版本的MVC? –
也許您的JavaScript緩存..在你的腳本參考嘗試添加?V = 1.1例如yourjavascript.js?V = 1.1,這將迫使最新版本的腳本來加載 –
,我認爲這是關係到MVC。我懷疑這是主要的js和jQuery .. – Arcadian