Wireless Army
This is a blog / tips and tricks website for web developers and security researchers.
follow us in feedly


make ajax work on ie
by admin
 at 2017-09-03 23:05:00.

here is a javascript code that make sure that user can use ajax on firefox, chrome, Opera safari and internet explorer.

There is not much to learn here, even I just come here to copy and past these lines.

var xmlHttp = createXmlHttpRequestObject();

function createXmlHttpRequestObject() {
var xmlHttp;
if(window.ActiveXObject) {
  try {
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"):
    }catch(e) {xmlHttp = false; }
  }
else {
  try {
    xmlHttp = new xmlHttpRequest():
    }catch(e) {xmlHttp = false; }

}
    if(!xmlHttp) {
      alert("can't use ajax");
    }
    else {
      return xmlHttp;
    }
}