sono riusciuto a dare un occhiata alla guida ajax ed ho riscritto la funzione in questo modo:
purtroppo ancora non funziona...codice:function ajax(){ this.objSOCK=null; this.openSock = function(){ var xmlhttp ; try{ xmlhttp = new XMLHttpRequest(); // Gecko (Firefox, Moz), KHTML (Konqueror, Safari), Opera, Internet Explorer 7 }catch(e){ var MSXML_XMLHTTP_PROGIDS = new Array( 'MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', // Internet Explorer 6 'Microsoft.XMLHTTP' // Internet Explorer 4,5 ); var success=false; for(var i=0;i < MSXML_XMLHTTP_PROGIDS.length && !success; i++){ try{ xmlhttp = new ActiveXObject(MSXML_XMLHTTP_PROGIDS[i]); success=true; }catch(e){} } if(!success) alert('attenzione: per navigare questo sito e necessario abilitare javascript o activeX'); } return xmlhttp; } this.printOut = function(target, html){ document.getElementById(target).innerHTML = html } this.requestPage = function(url, target, method, parameters) { if(method == undefined){method="GET";} ajax.objSOCK=this.openSock(); // creo l'oggetto XMLHttpRequest if(ajax.objSOCK){ //ajax.objSOCK.onreadystatechange=function(){alert(ajax.objSOCK.readyState);}; //ajax.objSOCK.onreadystatechange=function(){ajax.receiveResponse(target)}; ajax.objSOCK.onreadystatechange=function(){ if(ajax.objSOCK.readyState == 4) { if(ajax.objSOCK.status == 200 || ajax.objSOCK.statusText=="Found") { ajax.printOut(target, ajax.objSOCK.responseText); }else{ ajax.printOut(target, "error: "+ajax.objSOCK.statusText); } } }; ajax.objSOCK.open(method, url, true); if(method == "GET" || method == "get"){ ajax.objSOCK.send(''); }else{ ajax.objSOCK.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); ajax.objSOCK.setRequestHeader('Content-length', parameters.length); ajax.objSOCK.setRequestHeader('Connection', 'close'); ajax.objSOCK.send(parameters); } } } }
non so più dove sbattere la testa, le sto provando tutte...
qualcuno vede l'errore che a me proprio sfugge?![]()

Rispondi quotando