Salve a tutti,
ho provato a cercare nel forum un 3d simile ma continuo a ricevere errore...cmq
Sto sviluppando un sito in php, versione 5.2 di easyphp, e utilizzo ajax per un bel po' di aspetti...
Il problema consiste nel fatto che con chrome e firefox tutto fila liscio invece con ie ricevo un errore, per essere precisi due errori per ogni chiamata:
il primo sul javascript .js che fa la chiamata sincrona dove ie mi dice previsto identificatore:
nome.js
il secondo errore nella parte dove sostituisco l'innerhtml con la risposta dove ie mi dice:
previsto oggetto errore: 0 e niente piu'.
Pergarantire la compatibilità con vecchi browser uso la myGetXmlHttpRequest del w3c:
function myGetXmlHttpRequest(){
var xhr=false;
activeXoptions = new Array( "Microsoft.XmlHttp", "MSXML4.XmlHttp", "MSXML3.XmlHttp", "MSXML2.XmlHttp", "MSXML.XmlHttp" );
try{
xhr = new XMLHttpRequest();
}catch(e){
//vuota
}
if(!xhr){
var created = false;
for(var i = 0; i<activeXoptions.lenght && !created; i++){
try{
xhr = new ActiveXObject(activeXoptions[i]);
}catch(e){
//vuoto
}
created = true;
}
}
return xhr;
}
mentre la chiamata ajax è del tipo:
function aggiorna(text){
var theXhr = myGetXmlHttpRequest();
theXhr.onreadystatechange = function(){
if(theXhr.readyState === 4){
if(theXhr.status === 200){
//opero sul risultato per esempio id.innerHTML=responseText;
}
}
};
try{
theXhr.open("get", text, true);
}catch(e){alert(e);}
theXhr.setRequestHeader("connection","close");
theXhr.send(null);
}
Ho cercato sul web, sul w3c ma non riesco a risolvere!
Dimenticavo ie è alla versione 8.0.76 ecc
Grazie in anticipo per ogni eventuale aiuto.