Ciao, prova con:
Codice PHP:
function assegnaXMLHttpRequest() {
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");
} else{
XHR = new ActiveXObject("Microsoft.XMLHTTP");
}
}
return XHR;
}
function ajaxTest(dtx) {
var dtx = document.getElementById("data").value;
var ajax = assegnaXMLHttpRequest();
ajax.open("GET", "ServletDataGet?ry=" + dtx + "&_="+-new Date, true);
ajax.setRequestHeader("connection", "close");
ajax.setRequestHeader("content-type", "application/x-www-form-urlencoded");
ajax.onreadystatechange = function(){
if(ajax.readyState == 4){
alert(ajax.responseText);
}
}
ajax.send(null);
}