Four types of Jquery Ajax types: jqueryajax

Source: Internet
Author: User

Four types of Jquery Ajax types: jqueryajax

What does Ajax type fill in? Generally, get and post are used. So what are the other two?

$.ajax({  url: 'http://www.cnblogs.com/youku/',  type: '',  data: {}});

(Default: "GET") Request Method ("POST" or "GET"). The default value is "GET ". Note: Other HTTP request methods, such as PUT and DELETE, can also be used, but are only supported by some browsers.

 

Here is the online explanation

1. a GET request sends a data request to the database to obtain information. The request is like a select operation in the database. It is only used to query the data and does not modify or add data, does not affect the content of the resource, that is, the request does not produce any side effects. The results are the same no matter how many operations are performed.

2. Unlike GET, a PUT request sends data to the server to change the information. The request is used to modify the data content just like the update operation of the database, however, no data types are added. That is to say, no matter how many PUT operations are performed, the results are not different.

3. Similar to PUT requests, POST requests send data to the server, but the request changes the data type and other resources, just like the insert operation in the database, will create a new content. Almost all the currently submitted operations use POST requests.

4. a delete request, as its name implies, is used to delete a resource, which is like a DELETE operation in a database.

Simply put

1. Create POST/url

2. DELETE/url/xxx

3. PUT/url/xxx update

4. View GET/url/xxx

 

$.ajax({  url: 'http://www.cnblogs.com/youku/',  type: 'DELETE',  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.