Skip to content Skip to sidebar Skip to footer

Ajax V. Including Data In The Html

I'm using JavaScript with jQuery, talking to a Django back end. There are some UI needs that require Ajax, because we can't know what data to send until the user gives some input.

Solution 1:

The obvious answer in MOST applications is to include them directly, although I would always recommend treating every usage per its own needs. Remember that 'page load speed' is as much perception as it is a measurable stat, especially when dealing with ajax functionality.

Example

You have loads and loads of data to display, if you include it natively with the page will actually be perceived to take much more time to load to the end user than if you load the initial page and bring in the data in chunks. You can see this in place as an alternative to pagination that facebook uses, and the chunks of data are brought in as the user scrolls.

Solution 2:

Always include them directly if you have the choice, it will give a considerable benefit to page load speed.

Post a Comment for "Ajax V. Including Data In The Html"