我正在使用jQuery顯示/隱藏div容器(#pluginOptionsContainer),並在其中加載頁面(./plugin_options.php),並使用所需的POST變量發送。如何解決我在IE中的jQuery代碼?在Firefox中工作
什麼POST數據是基於選擇列表(#pluginDD)和一個按鈕(#pluginOptionsBtn)的點擊的價值被送到...
它工作在Firefox罰款,但不工作在IE中,'$(「#pluginOptionsContainer」).load()'請求似乎永遠不會在IE中完成 - 我只能看到永久加載的消息...
bind(),empty()和append )似乎都在IE中很好地工作。但不加載()..
這裏是我的代碼:
// wait for the DOM to be loaded
$(document).ready(function() {
// hide the plugin options
$('#pluginOptionsContainer').hide();
// This is the hack for IE
if ($.browser.msie) {
$("#pluginDD").click(function() {
this.blur();
this.focus();
});
}
// set the main function
$(function() {
// the button shows hides the plugin options page (and its container)
$("#pluginOptionsBtn") .click(function() {
// show the container of the plugin options page
$('#pluginOptionsContainer').empty().append('<div style="text-align:center;width:99%;">Loading...</div>');
$('#pluginOptionsContainer').toggle();
});
// set the loading message if user changes selection with either the dropdown or button
$("#pluginDD,#pluginOptionsBtn").bind('change', function() {
$('#pluginOptionsContainer').empty().append('<div style="text-align:center;width:99%;">Loading...</div>');
});
// then update the page when the plugin is changed when EITHER the plugin button or dropdown or clicked or changed
$("#pluginDD,#pluginOptionsBtn").bind('change click', function() {
// set form fields as vars in js
var pid = <?=$pid;?>;
var cid = <?=$contentid;?>;
var pDD = $("#pluginDD").val();
// add post vars (must use JSON) to be sent into the js var 'dataString'
var dataString = {plugin_options: true, pageid: pid, contentid: cid, pluginDD: pDD };
// include the plugin option page inside the container, with the required values already added into the query string
$("#pluginOptionsContainer").load("/admin/inc/edit/content/plugin_options.php#pluginTop", dataString);
// add this to stop page refresh
return false;
}); // end submit function
}); // end main function
}); // on DOM load
任何幫助將非常感謝!我討厭IE瀏覽器!
必須爲幾乎所有的jQuery的崗位做到這一點,很煩人,IE瀏覽器做到這一點。 – 2010-03-20 07:43:21
@Tom Anderson:IE不緩存來自POST請求的響應,只有GET。 – 2010-03-20 08:30:49
現在,它的工作原理...我之前嘗試過,使用一種稍微不同的生髮隨機數的方法,它不工作..但他的一個!非常感謝!!該死的你IE! – sc0ttman 2010-03-20 08:41:22