[AJAX] Ajax + ie = Probleme creation xhr
salut tout le monde
j'ai un petit soucis sous ie !! j arrive pas a creer une objet xhr :(
j'ai testé en mettant des alert un peu partout mais bon ca m'avance pas pour autant ! j'ai laissé volontairement dans le code un alert('test') car des ce niveau ca ne m'affiche plus rien :?
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| function ajax(num_pizza)
{
var xhr;
try{
//firefox Opera , Safari
xhr = new XMLHttpRequest();
}
catch(e)
{
//ie
try{ alert("Test");
xhr = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try{
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e)
{
alert("Le navigateur supporte pas AJAX !");
return false;
}
}
}
//on definit l'appel de la fcontion au retour serveur
xhr.onreadystatechange = function(){ recup_pizza(xhr,num_pizza); };
//on appelle le fichier qui liste les pizzas
xhr.open("GET","listePizza.php",true);
xhr.send(null);
} |