Caching JSON and AJAX requests

One way by which a web developer can increase the speed of his/her web application is by limiting the number of requests made to the web server. It is very important to ensure that you are making data calls only when you need to. We can use caching to ensure that requests are made only when a new set of data is required.

Getting ready

Ensure that your web server is up and running and you have permission to add files to the server's web root directory.

How to do it…

Learn how to speed up your JavaScript applications using simple caching methods by performing the following instructions:

  1. Create a PHP file named request-6.php in the web root of your web server. Use the following PHP code to create and output a list of names ...

Get jQuery 2.0 Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.