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

What are the commonly used ajax methods provided by jquery?

青灯夜游
Release: 2021-11-15 13:58:37
Original
5971 people have browsed it

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!

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