[Original] Sharp jquery Reading Notes (4)

Source: Internet
Author: User
Tags getscript
V. jquery operations on form tables

1. Focus () gets focus blur () loses focus

2. Set or retrieve the height of an element by height ().

3. scrolltop -- attributes that can be used for animate, for example, scrolltop: "+ = 50" scroll up

4. Trigger the verification event before submitting the form. Trigger ("Event") --> the triggerhandler ("Event") --> does not bubble

5. You can use cookies to save the user's skin.

 

Vi. jquery and Ajax

1. Ajax deficiency:

[1] insufficient support for XMLHttpRequest by the browser

[2] Destroy the "Forward" and "backward" button

[3] insufficient support for search engines

[4] lack of development and debugging tools

2. jquery Ajax hierarchy

Bottom layer: $. Ajax

Layer 2: load (), $. Get (), $. Post ()

Layer 3: $. getscript (), $. getjson ()

 

3. Load () method ---- mainly used to obtain static files

[1] load (URL)

[2] load (URL, ATTR, func ())

[3] load (URL, fun ())

 

4. $. Get () $. Post () ----- used to obtain Dynamic Content

[1] operations on jquery objects rather than global functions

[2] format: $. Get (URL, Data, callback, type)

$. Post (URL, Data, callback, type)

[3] callback function Format: function (data, textstatus ){}

Date: The returned content, which can be XML, JSON, or HTML.

Textstatus: Success, error, notmodified, timeout: the callback function is called only when the call is successful.

 

[4] processing callback Functions

If it is HTML, insert it directly.

If it is XML, it is processed and converted to HTML

If it is JSON, it is processed and converted to HTML

[5] difference between post and get

Get has parameters, and post has no parameters.

The size of data transmitted by get cannot exceed 2 kb, and the size of post cannot be greater than 2 kb.

The data in the GET request will be cached, and there will be security issues, and the post will not

Different Retrieval Methods

 

 

5. $. getscript () and $. getjson ()

[1] $. getscript () directly loads the JS file and adds a callback function to directly use

[2] $. getjson () directly loads the JSON file and adds a callback function.

 

6. $. Ajax Method

[1] format: $. Ajax (options)

[2] parameters exist in the form of key/value

[3] common parameters: URL/type/timeout/data/datatype/beforesend/complete/success/error/Global

 

7. serialized Elements

[1] serialize () serializes the content of DOM elements into strings

[2] serializearray () serializes DOM elements and returns JSON data

[3] $. Param () serialization Core

 

8. Global events

Ajaxstart ()

Ajaxstop ()

Ajaxcomplete ()

Ajaxerror ()

Ajaxsend ()

Ajaxsuccess ()

 

If you do not want to trigger a global event, set global to false.

 

 

All the Reading Notes in this book "sharp jquery" have been written, and there are many blind spots in it. I believe that in the future, we can gradually strengthen and gain a deeper understanding.

 

 

Author: Tony Zhao

Source: http://www.cnblogs.com/ytaozhao this article copyright to the author and blog park a total, welcome to reprint, but without the author's consent must retain this paragraph of the statement, and inArticleThe original text connection is clearly displayed on the page. Otherwise, the legal liability is retained.

 

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.