Home > Web Front-end > JS Tutorial > The difference between jquery post and ajax

The difference between jquery post and ajax

藏色散人
Release: 2022-12-30 11:13:32
Original
2194 people have browsed it

The difference between post and ajax in jquery: 1. $.ajax is the underlying AJAX implementation of jQuery, while $.post is a simple and easy-to-use high-level implementation; 2. $.post only handles post request functions to replace complex $.ajax; 3. Post is a further encapsulation of ajax and so on.

The difference between jquery post and ajax

The operating environment of this article: windows7 system, jquery1.2.6 version, Dell G3 computer.

What is the difference between jquery $.ajax $.get $.post?

$.ajax is the underlying AJAX implementation of jQuery. $.ajax is a general underlying package. After $.ajax() requests data, you need to use callback functions, including beforeSend, error, and dataFilter. , success, complete, etc.

$.get $.post is a simple and easy-to-use high-level implementation. We use the $.get $.post method, and jQuery will automatically encapsulate and call the underlying $.ajax.

$.get only handles simple GET request functions to replace the complex $.ajax. The callback function can be called when the request is successful. Executing functions on error is not supported, otherwise $.ajax must be used.

$.post only handles post request functionality to replace the complex $.ajax . The callback function can be called when the request is successful. Executing functions on error is not supported, otherwise $.ajax must be used.

$.get("test.php", { name: "John", time: "2pm" } ) The $.get method will automatically generate queryString and submit it to the server when requesting (name=John&time=2pm ), the data submitted by the

$.post method is directly similar to form submission, and the amount of data submitted is larger than $.get.

Recommended: "jquery video tutorial"

The difference is that get and post are further encapsulation of ajax, and the effect is the same as ajax execution The type is exactly the same as get or post.

get post The reason for doing this is to facilitate development. You don’t have to write ajax url scuess and the like every time.

get and post can solve it. Ajax definitely works, and ajax is more flexible.

The above is the detailed content of The difference between jquery post and ajax. 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