[Jquery tutorial] jquery Ajax Functions

Source: Internet
Author: User
What Is Ajax?

Ajax = Asynchronous JavaScript and XML.

Ajax is a technology for creating fast dynamic web pages.

Ajax allows asynchronous updates on webpages by exchanging a small amount of data with the server in the background. This means that it is possible to update part of the webpage without reloading the whole page.

Ajax and jquery

Jquery provides a rich library of functions (methods) for Ajax development.

Using jquery Ajax and http get and http post, you can request txt, HTML, XML, or JSON from a remote server.

In addition, you can directly load remote data into the selected HTML element of the webpage!

Jquery load function

Jquery's load function is a simple (but powerful) Ajax function. Its syntax is as follows:

$ (Selector). Load (URL, Data, callback)

Please useSelectorTo define the HTML elements to be changed, useURLParametersTo specify the web address of the data.

Only when you want to send data to the serverDataParameters. You must useCallbackParameters.

Low level Ajax

$. Ajax (options)Is the syntax of low-level Ajax functions.

$. Ajax provides more functions than high-level functions, but it is also more difficult to use.

OptionThe parameter is set to name | value pair, which defines URL data, password, data type, filter, Character Set, timeout, and error functions.

Jquery Ajax request

Request Description
$ (Selector). Load (URL, Data, callback) Load remote data to the selected Element
$. Ajax (options) Load remote data to the XMLHTTPRequest object
$. Get (URL, Data, callback, type) Use http get to load Remote Data
$. Post (URL, Data, callback, type) Use http post to load Remote Data
$. Getjson (URL, Data, callback) Use http get to load remote JSON data
$. Getscript (URL, callback) Load and execute remote JavaScript files

(URL) URL (address) of the loaded data)

(Data) Key/value object of the data sent to the server

(Callback) When the data is loaded, the executed Function

(Type) Type of the returned data (HTML, XML, JSON, jasonp, script, text)

(Options) All key/value pair options of the complete Ajax request

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.