Home >Backend Development >PHP Tutorial >Detailed example of quickly obtaining Ajax communication objects

Detailed example of quickly obtaining Ajax communication objects

小云云
小云云Original
2017-12-26 11:15:511651browse

This article mainly brings you a method to quickly obtain Ajax communication objects. The editor thinks it’s pretty good, so I’ll share it with you now and give it as a reference. Let’s follow the editor to take a look, I hope it can help everyone.

Examples are as follows:


##

function getXHR() {
  // 该方法用于获取Ajax通信对象
  var xhr = null;
  if (window.XMLHttpRequest != null &&
  window.XMLHttpRequest != undefined) {
  xhr = new XMLHttpRequest();
  } else {
  / 兼容早期的IE浏览器
  xhr = new ActiveXObject("Microsoft.XMLHTTP");
  }
  return xhr;
}

Related recommendations:


Detailed explanation of the example of django getting ajax post complex object

The problem of crawler getting AJax data

Jquery and JS use external variables to get the data returned by Ajax Method example of parameter value (super simple)_javascript skills

The above is the detailed content of Detailed example of quickly obtaining Ajax communication objects. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn