0
我有一個MainView「About.cshtml」它有一個腳本標籤和一個局部視圖。javascript的加載順序
<script>
$(function() {}
</script>
<div>
@Html.Partial("~/Views/Maps/_MapDetailsList.cshtml", Model.saVM)
</div>
內部 「_MapDetailList.cshtml」 部分觀點我正在引用另一個腳本ge.js
@Scripts.Render("~/Scripts/ge.js")
<table id="MapDetails">
.....
<tr><th>
<script>setGrowthArray(1, 1);</script>
</th></tr>
</table>
ge.js
var dictionaryGrowth = new Array();
function setGrowthArray(colIndex, mapDetailId) {
//making a sparse array
dictionaryGrowth[colIndex] = mapDetailId;
}
現在我想給這個dictionaryGrowth陣列到頁面/表格加載後的服務器端
so i的確在About.cshtml腳本以下,但因此未工作..
<script>
$(function() {
$("#MapDetails").load(function() { alert("everything seems fine");});
}
</script>
也請告訴我會在我的情況下,腳本和DOM加載順序。
UPDATE 大概當前序列是
- 腳本上About.cshtml執行
- ge.js執行局部視圖內
- 的document.ready燒製
- javascript函數(setGrowthArray)從內部DOM被稱爲
- 現在我想打電話給我的控制器? 如果我寫的window.onload = ...裏面ge.js這是從來沒有發射
做我還需要在控制器中標記服務器端動作爲[HttpPost] – Samra
在服務器檢查'POST'請求,其中鍵是''growth'' – guest271314
請參閱我的更新..現在它說Uncaught ReferenceError:dictionaryGrowth沒有在兩個$ .post和$(document).load – Samra