Home > Backend Development > PHP Tutorial > Which is faster, the ajax post submission method or the traditional post submission method?

Which is faster, the ajax post submission method or the traditional post submission method?

WBOY
Release: 2023-03-02 11:16:01
Original
1179 people have browsed it

If you use ajax and post at the same time, which one should be executed first? Should the post be executed after ajax returns or at the same time?

Reply content:

If you use ajax and post at the same time, which one should be executed first? Should the post be executed after ajax returns or at the same time?

The speed should be similar, but ajax has advantages in interaction. For example, a traditional post will cause the browser to enter another page. At this time, if the user clicks the refresh button, the browser will submit it again. Another example is the login operation. If the user fails to log in, When being kicked back to the login page, the user has to perform another network request. Using ajax can solve these problems

Traditional post requests will reload the entire page. Although the browser will cache it by default, some resources do not need to be reloaded. However, if you simply consider the speed of transmission, ajax is slightly faster. However, it is not clear whether the ajax post requires some parsing work. , so in fact the difference is not too big. How to do it depends on your needs.

Of course, execute js first and then execute the form event.

Related labels:
php
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