J'utilise jQuery pour afficher/masquer un conteneur div (#pluginOptionsContainer) et charger une page (./plugin_options.php) à l'intérieur avec les variables POST requises envoyées.Comment réparer mon code jQuery dans IE ?? Fonctionne dans Firefox
Quelles données POST est envoyé est basé sur la valeur d'une liste de sélection (#pluginDD) et le clic d'un bouton (#pluginOptionsBtn) ...
Il fonctionne très bien dans Firefox, mais ne fonctionne pas dans IE .. La '$ ("# pluginOptionsContainer"). load()' demande ne semble jamais finir dans IE - Je ne vois que le message de chargement pour toujours ...
bind(), vide() et append () tous semblent fonctionner correctement dans IE .. Mais pas charger() ..
Voici mon code:
// 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
Toute aide serait grandement appréciée! Je déteste IE!
A dû faire cela pour presque tous mes messages jQuery, assez ennuyeux que IE fait ça. –
@ Tom Anderson: IE ne cache pas les réponses des requêtes POST, seulement GET. –
Maintenant ça marche ... J'ai essayé ça avant, en utilisant une méthode légèrement différente de gernarating le nombre aléatoire et cela n'a pas fonctionné .. Mais son un FAIT! Merci beaucoup!! Merde, IE! – sc0ttman