Get the App
SLTechnology News&Howtos  ›  Network Security  › 

Native Ajax summary

Shulou Source: shulou.com Published: 2022-06-01 07:48:53 11月26日 Update

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);}}

Tags: Traditional objects servers formats processes programs pages processing Services Communications Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi NVidia vpn Shulou Technology MySQL