标签:http io os ar for sp on c cti
function ajaxRequest(url, params, processor, async) {
url = url || ‘‘;
async = async || false;
params = params || {};
var req = null;
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
}
var tmp = "";
for (var i in params) {
tmp = tmp + i + "=" + params[i] + "&";
}
//alert(tmp);
if (req) {
req.open("GET", url + "?" + tmp, async);//true,ajax false异步、true同步
req.onreadystatechange = function() {
if (req.readyState == 4 && req.status == 200) {
var result = req.responseText;
//document.body.innerHTML = document.body.innerHTML + result;
if (processor) {
processor(result);
}
}
};
req.send(null);
}
}
标签:http io os ar for sp on c cti
原文地址:http://www.cnblogs.com/liyong0125/p/3995946.html