jquery Ajax Call (a)--load pass data

Source: Internet
Author: User
Tags getscript



One, theload method asynchronously requests data

Use the load () method to load the data from the server via an AJAX request and place the returned data into the specified element, which is called in the following format:

Load (Url,[data],[callback])

The parameter URL is the load server address, and optionally the data parameter is the callback function that is sent when the data request is requested, and the callback parameter is the execution of the database.







Two, asynchronously loading JSON- formatted data using the Getjson () method


Using the Getjson () method, you can obtain an array from the server by means of an AJAX asynchronous request, and parse the obtained data into the page, which is called in the following format:


Jquery.getjson (Url,[data],[callback]) or $.getjson (Url,[data],[callback])


Where the URL parameter is the server address for the request to load the JSON-formatted file, the option data parameter is the one that is sent when the request is requested, and the callback parameter is the callback function that executes after the data request succeeds.








third, asynchronously loads and executes the JS file using the getScript () method


Use the Getscript () method to asynchronously request and execute a JavaScript-formatted file in the server with the following invocation format:


Jquery.getscript (Url,[callback]) or $.getscript (Url,[callback])


The parameter URL is the server request address, and the optional callback parameter is the callback function that executes after the request succeeds.





Four, use the Get () method to Get the data from the server in Get mode


When using the Get () method, a Get method is used to request data to the server, and the requested data is returned through the parameters of the callback function in the method, and its invocation format is as follows:


$.get (Url,[callback])


The parameter URL is the server request address, and the optional callback parameter is the callback function that executes after the request succeeds.








Five, use the post () method to send data from the server in post


Compared to the Get () method, the post () method is used to send data to the server in post, the server receives the data, processes it, and returns the processing result to the page, called the following format:


$.post (Url,[data],[callback])


The parameter URL is the server request address, optionally the data to be sent to the server when requested, the optional callback parameter is the callback function executed after the request succeeds.














jquery Ajax Call (a)--load pass data

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.