ASP.NET MVC アプリケーション。
問題があるのは IE だけです。
次の 2 つの関数を検討してください。
function refreshParameters() {
doRefresh('#loading-production-parameters', '#partial-rows-parameters', '@VirtualPathUtility.ToAbsolute("~/home/ProductionParameters")');
}
//
//
//
function refreshTotals() {
doRefresh('#loading-production-totals', '#partial-rows-totals', '@VirtualPathUtility.ToAbsolute("~/home/ProductionTotals")');
}
スクリプトとイベント ハンドラの開始:
$(function () {
//
//Init
//Initial Tasks
//
refreshParameters();
refreshTotals();
//
// Events
//
$('#yla-debug').click(function (e) {
refreshParameters();
refreshTotals();
});
奇妙なことに、ページの読み込み時に実行されますrefreshParameters
。refreshTotals
しかし、クリックイベントハンドラーではそうではありません。
イベントハンドラーにアラートを入れると、正常に起動し、firebug のコンソールにもエラーは表示されません。
何か案は?
PS: イベントを使用する要素の html マークアップ:
<div id="yla-debug" class="panel panel-default">
<div class="panel-heading clearfix">
<h3 class="panel-title pull-left">Daily Production Data for <span style="font-weight: bold;">@ViewBag.SiteName</span> </h3>
<span style="font-weight: normal; background-color: #000080;" class="badge pull-left">(Autoupdate every 30 min.)</span>
<div class="pull-right" id="loading-production-parameters">
<span>Refreshing</span>
<img src="~/Content/ajax-loader-bar1.gif" />
</div>
</div>
<div class="panel-body">
<table id="partial-rows-parameters" class="table table-striped table-hover">
</table>
</div>
<div class="panel-footer">
<span>Last Refresh: </span>
<span id="last_refresh_parameters"></span>
</div>
</div>
追加情報 #1:
セレクターをより一般的なものに置き換えても機能しません。$('body), $('img')
....
追加情報 #2:
doRefresh
イベントから呼び出されたときに実行されず、起動時に実行されるメソッド:
function doRefresh(what, dataContainer, action) {
$(what).show();
$.ajax({
url: action,
dataType: 'html',
success: function (data) {
$(dataContainer).html(data);
$(what).hide();
}
});