Ajax v., Including data in HTML

I use javascript with jQuery, talking to the back end of Django. There are some user interface needs that require Ajax because we cannot know what data to send until the user gives any input. However, there is other data that is known during the template. What are the advantages and disadvantages of including this data in a template directly, instead of using Ajax? It seems that the first could be simpler.

+3
source share
2 answers

The obvious answer in MOST applications should include them directly, although I always recommend considering each use in accordance with its own needs. Remember that "page loading speed" has the same perception as the measured stat, especially when working with the ajax function.

Example

You have downloadable and downloadable data, if you actually enable it using the page, in fact, it will take much longer for the end user to download than when loading the original page and entering data into pieces, you can see it in place as An alternative to the pagination used by facebook, and chunks of data are given when the user scrolls.

+3
source

, , .

0

Source: https://habr.com/ru/post/1793657/


All Articles