Ajax Initializer

来源:互联网 发布:unity3d 雷达图 编辑:程序博客网 时间:2024/06/01 21:39
function xmlhttpPost() {var xhr;var method = "GET";if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safarixhr = new XMLHttpRequest();  if ("withCredentials" in xhr)  {             xhr.open(method,jsonendpoint,true);    }     else if (typeof XDomainRequest != "undefined")    {        //xhr = new XDomainRequest();        xhr=new ActiveXObject("Microsoft.XMLHTTP");        xhr.open(method,jsonendpoint);    } else {        xhr = null;    }}else{// code for IE6, IE5  xhr=new ActiveXObject("Microsoft.XMLHTTP");}xhr.onreadystatechange=function(){    if (xhr.readyState == 4)    {    document.getElementById("maindiv").innerHTML = xhr.responseText;    }};xhr.setRequestHeader("Content-type", "application/json");xhr.send(/*"condition="+document.getElementById("sql_condition").value*/);}


原创粉丝点击