uso questo codice per usare ajax.. e funziona se carico pagine con del solo testo.. ma se all'interno di queste pagine c'e' del javascript anche un semplice alert(''ciao); questo viene ignorato.. sia in ie che firefox.. qualcuno sa aiutarmi ad estendere questo codice affinche' venga interpretato anche il javascript della pagina chiamata ?
codice:function createXMLHttp() { 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('Cant create XMLHttpRequest - not supported'); } } return xmlhttp; } function getFile(file,callbackFunction) { //alert("getFile("+file+")"); var xmlHttpObj = null; xmlHttpObj=createXMLHttp(); // xmlHttpObj.open("HEAD", file, true); xmlHttpObj.open('get', file); var argomenti=arguments; //alert("001 :"+argomenti.length); xmlHttpObj.onreadystatechange = function() { if (xmlHttpObj.readyState == 4) { switch(xmlHttpObj.status) { case 200: // Page found case 304: // Status Code on Opera when page reload this.size = xmlHttpObj.getResponseHeader("Content-Length"); this.text = xmlHttpObj.responseText; str="callbackFunction(this"; for(j=2;j'+file+''); /*data1=this; for(i in data1){ document.write(" [" + i+ "] "+data1[i]+""); }*/ return; break; } } } xmlHttpObj.send(null); delete xmlHttpObj; }




Rispondi quotando
