1 function Ajax(url) { 2 //url请求地址 3 var m_xmlReq = null; 4 if (window.ActiveXObject) { 5 try { 6 m_xmlReq = new ActiveXObject('Msxml2.XMLHTTP'); 7 } 8 catch (e) { 9 try {10 m_xmlReq = new ActiveXObject('Microsoft.XMLHTTP');11 }12 catch (e) {13 14 }15 }16 }17 else if (window.XMLHttpRequest) {18 m_xmlReq = new XMLHttpRequest();19 }20 this.post = function(data) {21 if (!m_xmlReq)22 return;23 m_xmlReq.open('POST', url, false);24 m_xmlReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;charset=gb2312');25 m_xmlReq.send(data);26 return m_xmlReq.responseText;27 }28 }