jquery: A JS-based framework

Source: Internet
Author: User
Tags http post

jquery: A JS-based framework

Frame: 1, easy to use 2, solve the problem of compatibility

Official website jquery.com (2-point version does not support IE6, 7, 8)

This

Objects in the current environment

Closures (Closer)

1, you can keep local variables persist

Within a function (object), a function is defined, which can access the local variables of the outside function, and can be used to refer to the outside variables, which can persist local variables.

A function must contain a function, and to refer to the variables outside the function, inside the function must be returned, you can use the same name of the variable

Disadvantage: Memory consumption needs to be relatively large, may lead to memory leaks

Programming of functions

Imperative language (emphasis on process): process-oriented and object-oriented

Statement language (language-focused):

1, dsl:mysql statements, CSS, etc.

2. Functional language: No global variables, no concurrency problems, less code required, higher threshold for learning

jquery can be converted to JS by the Get method;

Selector Selector

1. Element Selector

2. Id Selector

4. Descendant selector form input contains the grandchild element

5, sub-selector form>input

6, brother selector Label+input can get the input label behind the label

1, even even odd radix 2, GT greater than LT is less than

jquery Ajax

Concept: JQuery underlying AJAX implementation. Easy to use high-level implementation see $.get, $.post and so on. $.ajax () returns the XMLHttpRequest object that it created. In most cases you do not need to manipulate the function directly unless you need to manipulate the infrequently used options for more flexibility.

The process of sending and receiving information: page, server, method->aja

$ ("from"). Serialize (); Remove all values in the form form that have the name attribute

1. HTTP GET request loading information.

This is a simple GET request feature to replace complex $.ajax. The callback function can be called when the request succeeds. If you need to execute the function on error, use $.ajax.

2. HTTP POST request loading information.

This is a simple POST request function to replace the complex $.ajax. The callback function can be called when the request succeeds. If you need to execute the function on error, use $.ajax.

3. HTTP GET requests Load JSON data.

In JQuery 1.2, you can load JSON data for other domains, such as "myurl?callback=?", by using a callback function in the form of JSONP. Will jQuery be replaced automatically? is the correct function name to execute the callback function. Note: The subsequent code of this line will be executed before this callback function executes.

A, Ajax method of sending JSON object: Response.json ();

jquery: A JS-based framework

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.