1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
var
createAjax,
defaultType = 'application/x-www-form-urlencoded';
if (window.ActiveXObject) {
createAjax = function (method, URI, mbody, handler, type) {
var
XHR = new ActiveXObject ('Microsoft.XMLHTTP'),
type = type || defaultType;
XHR.onreadystatechange = handler;
XHR.open(method, URI, true);
XHR.setRequestHeader ('Content-Type', type);
XHR.send(mbody);
};
} else if (window.XMLHttpRequest) {
createAjax = function (method, URI, mbody, handler, type) {
var
XHR = new XMLHttpRequest(),
type = type || defaultType;
XHR.onreadystatechange = handler;
XHR.open(method, URI, true);
XHR.setRequestHeader ('Content-Type', type);
XHR.send(mbody);
};
} else {
createAjax = function () {
return false;
};
}
handleAjaxXML = function () {
if (this.readyState == 4 && this.status == 200) {
alert(this.responseText);
}
}
createAjax('Post','/4DACTION/MonSuperTest/'+string,'',handleAjaxXML); |
Partager