function ajax(url, onsuccess, onfail) {
var xmlHttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
xmlHttp.open("POST", url, true);
xmlHttp.onreadystatechange = function () {
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
onsuccess(xmlHttp.responseText);
}
else {
onfail(xmlHttp.status);
}
}
}
xmlHttp.send();
}