Home  >  Article  >  Web Front-end  >  What are the commonly used ajax methods provided by jquery?

What are the commonly used ajax methods provided by jquery?

青灯夜游
青灯夜游Original
2021-11-15 13:58:375938browse

The commonly used ajax methods provided by jquery are: 1. "$.ajax()" method, used to perform asynchronous HTTP (Ajax) requests; 2. "$.get()" method; 3. "$ .post()" method; 4. "$.getJSON()" method; 5. "serialize()" method, etc.

What are the commonly used ajax methods provided by jquery?

The operating environment of this tutorial: windows7 system, jquery1.10.2 version, Dell G3 computer.

Native AJAX requests are sent in native JavaScript, which is very cumbersome. Using jQuery will be simpler and faster.

Native AJAX request

##AJAX request in JQuery

$.ajax method

url represents the requested address

type represents the type of request GET or POST request

data represents the data format sent to the server There are two types: One: name=value&name=value Two: {key:value}

success The request is successful, the response callback function

dataType The response data type. Commonly used data types are: text Represents plain text xml Represents xml data json Represents json object

$.get method and $.post method

url requested url address

data sent data

callback successful callback function

type returned data type

because get or post has specified the request Type, so there is no need to pass in the type parameter

$.getJSON method

url Requested url address

data Data sent to the server

callback Successful callback function

Same as before, specify the type of request and the type of data returned, so you can pass less Two parameters.

Form serialization serialize()

serialize() can obtain the contents of all form items in the form to, and concatenate them in the form of name=value&name=value.

Recommended related video tutorials:

jQuery Tutorial (Video)

The above is the detailed content of What are the commonly used ajax methods provided by jquery?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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