how to enable caching in jquery ajax

前端 未结 1 1099
谎友^
谎友^ 2020-12-31 20:33
jQuery(\"#divProviders img\").click(function (e) {
    //alert(jQuery(this)[0].nameProp);
    document.getElementById(\"TxtProvPic\").value = jQuery(this)[0].getAttr         


        
相关标签:
1条回答
  • 2020-12-31 21:01

    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.

    0 讨论(0)
提交回复
热议问题