On Ajax correlation and its advantages and disadvantages _ajax correlation

Source: Internet
Author: User
Tags serialization

AJAX, asynchronous Javascript and XML, enables no Refresh Status update page and asynchronous commit

Advantages:

No plug-in support required
The user experience is very good
Improve Web program performance
Ease the burden on servers and broadband

Disadvantages:

The forward Back button is corrupted
Search engine support is not enough
Lack of development debugging tools

Synchronous and asynchronous

Sync: That is, you have to do one thing, wait till the last piece is done before you do the next thing.
Asynchronous: No need to wait until the first thing is done, but do something

jquery has three-tier encapsulation of Ajax

Bottom: Encapsulates some of the basic AJAX operations;

Global method: $.ajax ()
The submitted data is submitted by post, and the data submitted must be "{}" wrapped and submitted in the form of "Key:value".
When submitting an entire form, you can use the form to serialize "serialize ()" To submit the entire form
decodeURIComponent (): Data that is serialized
encodeURIComponent (): Serialization of data, Serialize () is also called this method for serialization
Serializearray (): form converted to JSON
$.ajaxsetup (): Initializes the data for $.ajax () to set the default value of the $.ajax () object
Layer Two: Ajax encapsulated in jquery;

Local method:. Load (Url,data,callback)
Comparison of asynchronous fetching for static files
Global approach: $.get (Url,data,callback,type), $.post (Url,data,callback,type)
Can be obtained asynchronously with a dynamic file
Third layer: encapsulation of get;

Global method: $.getjson,$.getscript

Load Request

$ (document). Ajaxstart (function): The method that is triggered when the request starts

$ (document). Ajaxstop (function): method that is triggered at the end of a request

JSON and JSONP

When datatype is JSON, data cannot be fetched across domains, and "callback=" can be added after adding a domain name to enable Cross-domain call data. When datatype is JSONP, cross-domain fetch data can be realized directly.

JQXHR objects

The properties and methods of the JQuery JQXHR object

The above mentioned is the entire content of this article, I hope you can enjoy.

Related Article

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.