Tag:xmlHttp

  • Xmlhttp garbled code relatively complete solution (utf8, GB2312 encoding and decoding)

    Time:2022-4-30

    There are two reasons for the form garbled code when using xmlhttp # post # form – Chinese garbled code when using post form data; The server response is garbled due to incorrect encoding of xmlhttp. In other words, this paper mainly solves two problems – how to correctly post Chinese content and how to […]

  • Xmlhttp multi browser compatibility writing method

    Time:2022-4-19

    Copy codeThe code is as follows: var xmlhttp=null;  if (window.XMLHttpRequest) {  xmlhttp = new XMLHttpRequest();  }  if (!xmlhttp&&window.ActiveXObject)  {      try      {          xmlhttp = new ActiveXObject(“Msxml2.XMLHTTP.5.0”)      }      catch(e)      {          try          {              xmlhttp = new ActiveXObject(“Msxml2.XMLHTTP.4.0”)          }          catch(e)          {              try              {                  new ActiveXObject(“Msxml2.XMLHTTP”)              }              catch(e)              {                  try{new ActiveXObject(“Microsoft.XMLHTTP”)}catch(e){}              }          }      }  }  If (! Xmlhttp) {alert (“xmlhttp is not available. About to jump to a non ajax page.”); location=”nonAjax.htm”}

  • Ajax creates perfect compatibility code for xmlhttp objects

    Time:2021-11-6

    Copy codeThe code is as follows: function creatajax(){ var ajax=null; if (window.XMLHttpRequest){ //For Mozilla, Netscape, Safari and other browsers, create the XMLHttpRequest objectajax = new XMLHttpRequest(); if (ajax.overrideMimeType){ //If the header of the server response is not text / XML, you can call other methods to modify the headerajax.overrideMimeType(‘text/xml’); } } else if (window.ActiveXObject){ //For […]

  • If xmlhttp IE6 is not cross domain, it indicates that there is no permission. This error will not occur under IE8

    Time:2019-12-26

    If the URL is too long, you will be prompted that you do not have permission. IE8 does not. This should be related to the browserIn fact, one of the problems you should pay attention to is that it can be solved by changing to post modethis.xmlHttp.open(“POST”, this.url, true); //alert(‘end’); this.xmlHttp.setrequestheader(“content-length”,this._data.length); this.xmlHttp.setrequestheader(“content-type”,”application/x-www-form-urlencoded”); this.xmlHttp.onreadystatechange = Page; […]