Home > Web Front-end > JS Tutorial > body text

4 types of Jquery Ajax type

炎欲天舞
Release: 2018-05-10 11:48:58
Original
3300 people have browsed it

Ajax type What to fill in? Usually everyone talks about get and post. So what are the other two?

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

(Default: "GET") Request method ("POST" or "GET"), the default 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 explanation found on the Internet

1. The GET request will send a request to the database to retrieve data. , to obtain information. This request is just like the select operation of the database. It is only used to query the data. It will not modify or add data, and will not affect the content of the resource, that is, the request will not have side effects. No matter how many times you perform the operation, the result is the same.

2. Different from GET, the PUT request sends data to the server to change the information. This request is like the update operation of the database, used to modify the content of the data, but does not add data. Type, etc., that is to say, no matter how many PUT operations are performed, the results will not be different.

3. POST requests are similar to PUT requests. They both send data to the server. However, this request will change the type of data and other resources, just like the insert operation of the database, it will create new content. Almost all current submission operations are requested using POST.

4. The DELETE request, as the name suggests, is used to delete a certain resource. This request is like the delete operation of the database.

Simply put it is

1. POST /url creation

2. DELETE /url/xxx delete

3. PUT /url/xxx update

4. GET /url/xxx view

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


The above is the detailed content of 4 types of Jquery Ajax type. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template