Hello, welcome toPeanut Shell B2B Foreign Trade Network_Professional B2B E-commerce Platform_Free B2B Information Publishing Network!
18951535724

The original javascrpit has requested ajax to achieve it

   2026-03-07 NetworkingName1690
Key Point:The code above contains detailed notes, and the principle of ajax is simple and, in general, sends data using xmlttprequest objects. Here's an additional description of the subject。The code uses many boolean expression short-circuit features instead of conditional statements, and good use of boolean short-circuit features allows a large number of simple conditional statements to be simplified. - yeahBasic properties of xmlttprequest object

The code above contains detailed notes, and the principle of ajax is simple and, in general, sends data using xmlttprequest objects. Here's an additional description of the subject。

The code uses many boolean expression short-circuit features instead of conditional statements, and good use of boolean short-circuit features allows a large number of simple conditional statements to be simplified. - yeah

Basic properties of xmlttprequest objects

Jsonp principles and simple realization

Readystate properties have five state values:

0: uninitiated: not initialized. Xmlttprequest objects have been created but not initialized。

One is loating: i'm ready to send。

2: loeded, sent but no response received。

Jsonp principles and simple realization

3: it's interactive: receiving response, but not yet。

4: completed: response accepted。

Responsetext: response text returned by the server. Only when readystate > = 3. When readystate=3, the returned response text is incomplete and only readystate=4 received the complete response text. Responsexml: response information is xml and can be parsed as dom object. Status: the http status code for the server, if 200, is ok, 404, indicating that it was not found. Statustext: the text of the server's http status code. Ok, not found。

Basic method for xmlttprequest object

Jsonp principles and simple realization

Open (method, url, asyn): open xmlhttprequest object. Among them, the method method is get, post,delete, put. Url is the address where resources are requested. The third parameter indicates whether or not a step is used. The default situation is true, because ajax is characterized by a walk-through. If you use sync, false. Send (body): send request ajax. The content to be sent can be the required parameters, and if not, directly send (null)

Use method

Directly calls the ajax function as defined above and transmits the corresponding options and parameters。

 
ReportFavorite 0Tip 0Comment 0
>Related Comments
No comments yet, be the first to comment
>SimilarEncyclopedia
Featured Images
RecommendedEncyclopedia
Table of Contents1 sections