How to make Ajax Cacheable

How to make Ajax Cacheable
By Tapas Pal Updated

AJAX is extensively used on all modern web applications. The ability to grab content on the fly using asynchronous calls improves user experience by providing a native desktop application feel.

You can enhance the user experience by optimizing your AJAX calls. Remember, AJAX does not guarantee that the user will receive the response instantly. The most simple way to enhance AJAX performance is to make AJAX response cacheable.

How to make Ajax Cacheable

AJAX calls are normal HTML calls made asynchronously. Simply put, this means all techniques that make normal HTML cacheable applies to make AJAX cacheable.

To make AJAX cacheable, set cache-control and expires header of the AJAX response. To know more about how to set expires header, read our article How to add Expires Header.

Don’t forget the other ways to improve HTML and AJAX performance

Note: When using AJAX, make the response as small as possible for best performance.