![](/img/trans.png)
[英]Javascript: Detect if Internet Explorer sent the mixed http on https page message
[英]Javascript: Detect load in ascx page. Internet Explorer
我有一個下拉菜單,它將觸發ChangeGraph javascript函數。 在Chrome / Firefox中,加載我的局部視圖(.ascx)后,我會收到“ hello”警報。 IE中不是這種情況。 關於如何解決這個問題的任何想法。 基本上,一旦使用“ $('#GraphForm')。html(data);”編寫ascx頁面,就無法啟動javascript函數。
從我的Index.aspx:
<div id="GraphForm"></div>
Javascript:
function ChangeGraph(displayTypeId) {
$('#GraphForm').html("");
$.get('/Dashboard/GetGraphForm', { id: displayTypeId }, function(data) {
$('#GraphForm').html(data);
});
}
控制器:
public PartialViewResult GetGraphForm(int id)
{
//... Build Model (removed)
return PartialView("EnergyConsumedFormView"/* , model */);
}
EnergyConsumedFormView.ascx Javascript:
<script type="text/javascript">
$(document).ready(function() {
alert('hello');
});
</script>
我是javascript新手,所以直到我弄清楚答案之前,答案並不明顯。 知道這似乎很明顯。 如果您不在乎文檔是否准備就緒,只需調用該函數即可。
<script type="text/javascript">
alert('hello');
</script>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.