jquery - random number added to ajax requests -
jquery - random number added to ajax requests -
i working asp.net mvc , jquery. calling controller actions jquery using
$.getjson("/customer/details", function (data) { // process info }); i have output cache set on controller action not working seems cache getting busted url contains random number eg.
https://localhost/customer/details?_=1403629723467 this not beingness populated me framework. way can stop beingness added ur?
that's because of cache: false. prevents browser fetching content it's cache , used get & head requests.
you can confirm -- obvious reasons not advise leave setting on - can turn off , won't see number:
$.ajaxsetup({cache:true}); cache (default: true, false datatype 'script' , 'jsonp') type: boolean if set false, forcefulness requested pages not cached browser. note: setting cache false work correctly head , requests. works appending "_={timestamp}" parameters. parameter not needed other types of requests, except in ie8 when post made url has been requested get.
reference:
- http://api.jquery.com/jquery.ajax/ jquery asp.net json asp.net-mvc-4
Comments
Post a Comment