js-Authoritative Guide Study notes 18

Source: Internet
Author: User

1. All mouse events except MouseEnter and mouseleave can be bubbling.

2. The Event object passed to the mouse event handler has the Clientx and Clienty Properties , which establish the coordinates of the mouse pointer relative to the containing window.

3. A KeyPress event represents a single character entered, and the event object specifies the character in Unicode encoding, so it must be converted to a string using String.fromCharCode () .

4. You can block character input by canceling textInput, TextInput, keypress events, which means that you can use these events to filter the input.

18th Chapter Scripting HTTP

1. The term Ajax describes a Web application architecture that primarily uses scripting to manipulate HTTP.

2, in Ajax, the client pulls data from the server, while in comet, the server pushes the data to the client .

3, <script> elements have the ability to circumvent the same-origin restriction (JSONP).

4, an HTTP request consists of 4 parts: 1, HTTP request method or action. 2. The URL being requested. 3. An optional collection of request headers, which may include authentication information. 4, an optional request body.

5 . The HTTP response returned by the server contains 3 parts: 1, a number and a text-based status code to show the success and failure of the request. 2. A collection of response headers. 3, the response body.

6.get is used for regular requests , and he applies when the URL completely specifies the request resource when the request does not have any side effects on the server and when the server's response is cacheable. The post method is commonly used in HTML forms , which contain additional data in the request body and are often stored in the server's database (side effects).

7. Theparts of the HTTP request are in the specified order: The request method and URL arrive first, then the request header, and finally the request body.

8. To listen for the ReadyStateChange event, set the event handler function to the onreadystatechange property of the Xhr object.

9, asynchronous processing HTTP response is the best method, however, XHR also supports synchronous response. If false is passed as the third argument to open (), then the Send () method blocks until the request is complete. Avoid use .

10. Testing the existence of withcredentials is a way to test whether the browser supports CORS .

11, using the <script> element as the Ajax transmission technology becomes JSONP, if the HTTP request received the response data is JSON-encoded, it is appropriate to use the technology.

js-Authoritative Guide Study notes 18

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.