Код:
var httpRequest = createHttpRequest();
function createHttpRequest() {
var httpRequest;
var browser = navigator.appName;
if (browser == "Microsoft Internet Explorer") {
httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
} else {
httpRequest = new XMLHttpRequest();
}
return httpRequest;
}
function process(n) {
name = document.getElementById(n).value;
document.getElementById('divMessage').innerHTML = "<img src='images/upload.gif'>";
httpRequest.onreadystatechange = getRequest;
httpRequest.open("POST", "quickstart.php");
httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=windows-1251');
httpRequest.send("id=" + name);
}
function getRequest() {
if (httpRequest.readyState == 4) {
document.getElementById('divMessage').innerHTML = httpRequest.responseText;
}
}