Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Native Ajax summary

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

HTTP protocol

Traditional requests and Ajax requests

Ajax definition

Asynchronous JavaScript and XML. Ajax is asynchronous, and JavaScript programs want to communicate directly with the server without reloading the page.

Basic process of Ajax

1. Create a request object

Function requestObject () {if (window.XMLHttpRequest) {return new XMLHttpRequest ();} else if {return new ActiveXObject ('Mxsml2.XMLHTTP');} else {throw new Error ("Could not create HTTP request object.");}}

two。 Establish request

Var request=requestObject ()

Request.open ("GET", "data.txt", true)

3. Send a request

Request.send (null)

4. Processing requests (both XML and JSON formats)

Request.onreadystatechange=function () {if (request.readyState==4) {console.log (request.status+ ":" + request.statusText);}}

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report