Skip to content Skip to sidebar Skip to footer

How To Enable Caching In Jquery Ajax

jQuery('#divProviders img').click(function (e) { //alert(jQuery(this)[0].nameProp); document.getElementById('TxtProvPic').value = jQuery(this)[0].getAttribute('src'); //jQu

Solution 1:

cache:true is the default and does not always get the content from the cache. The cache-ability of an item on the browser is determined by:

  • The response headers returned from the origin web server. If the headers indicate that content should not be cached then it won’t be.

  • A validator such as an ETag or Last-Modified header must be present in the response.

From this link

cache:false has another use case to always load the content from server regardless of whether that content is cached or not.

The point here is: the cache-ability is determined by the server and cache:true or cache:false of the $.ajax is just to determine whether to look for the cached response or not.

Post a Comment for "How To Enable Caching In Jquery Ajax"