Home > Web Front-end > JS Tutorial > How to quickly obtain Ajax communication objects

How to quickly obtain Ajax communication objects

亚连
Release: 2018-05-22 14:47:19
Original
1230 people have browsed it

Below I will bring you an article on how to quickly obtain Ajax communication objects. Let me share it with you now and give it as a reference for everyone.

The 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;
}
Copy after login

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

The problem of passing array parameters by calling webservice in jQuery through ajax (graphic tutorial)

Use ajaxDetailed explanation of the method of passing arrays and receiving in the background

How to solve the problem of Ajax passing data with special characters

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template