Sto imparando ajax.
Ho provato così :
Mi funziona su ie , non su firefox.Codice PHP:<script language="JavaScript" >
function get_ajax() {
var XHR = null,
browserUtente = navigator.userAgent.toUpperCase();
if(typeof(XMLHttpRequest) === "function" || typeof(XMLHttpRequest) === "object")
XHR = new XMLHttpRequest();
else if(
window.ActiveXObject &&
browserUtente.indexOf("MSIE 4") < 0
) {
if(browserUtente.indexOf("MSIE 5") < 0)
XHR = new ActiveXObject("Msxml2.XMLHTTP");
XHR = new ActiveXObject("Microsoft.XMLHTTP");
}
return XHR;
}
ajax = get_ajax();
if (ajax)
{
ajax.open('GET','try.html');
ajax.setRequestHeader("connection", "close");
ajax.onreadystatechange = function() {
if (ajax.readyState == 4 && ajax.status == 200) {
document.write(ajax.responseText);
}
}
ajax.send(null);
}
</script>

Rispondi quotando