Home  >  Article  >  Backend Development  >  javascript - What are the adverse effects of using too much Ajax? How to deal with it?

javascript - What are the adverse effects of using too much Ajax? How to deal with it?

WBOY
WBOYOriginal
2016-08-04 09:19:321108browse

When comparing data in the development backend management system, AJAX is used on the front end. If it is used too much, what are the disadvantages? How to improve?

Reply content:

When comparing data in the development backend management system, AJAX is used on the front end. If it is used too much, what are the disadvantages? How to improve?

There is basically no io on the front end, and ajax is the absolute main communication method.

Thinking it all together, an ajax is a request. Too many requests will naturally affect performance. However, if ajax requests a lot of data at once and parses it on the page, it will also be very troublesome.
A page will definitely involve a lot of data. How to divide this data must be considered in all aspects, including writing efficiency, UI interaction, etc.

In general, it still depends on experience and how to do the smallest unit processing.

magento2 uses knockoutjs extensively, and a lot of data comes from AJAX. It will be a good reference.

The most common problems are the architectural design of large number of requests and partial data refresh.

  • The data downloaded by AJAX should be cached and will be retrieved again after being notified.

  • How can the locally refreshed data not affect the data of other blocks?

The above problems require a relatively macro-architectural design to solve them.

I don’t feel that Ajax has any adverse effects. If there is a problem, how can the SPA survive? .

From the perspective of user interaction, AJAX has more benefits and improves user experience.
From the perspective of request concurrency, it is not good, but it can also be solved through caching. Of course, the server side usually does it as well.

Shouldn’t all the backend management systems being developed now be routed by js and be a single page? Why is there still such a thing as ajax?

The CSS Sprite (CSS sprite) technology that combines multiple icons into one image is actually to reduce network requests.
It can be seen that reducing network requests can improve the performance of both the browser and the server.
Too much AJAX means network There are more requests, and obviously too many are bad.
But when AJAX is used for some background page turning and message notifications, the experience is still good.

If it is separation of front and back, ajax is a key interactive communication method. What you have to deal with is the asynchronous control process of ajax

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