How long do browsers keep the cache of AJAX requests?
eg.
$.ajax({
type: "GET",
url: "GetStockLevel.ashx?productId="+productId,
success: function(data) { alert(data; }
});
I don’t mind if it’s cached for a few minutes. But if it caches for say 30 minutes then it would be a problem.
And can we set the cache expiry? (eg. to 1 minute)
I know I can set cache to false, but I’m just curious 🙂 Thanks in advance!
You could control caching by adding
to your GetStockLevel.ashx handler.
If the expires header is absent, the time that the page is cached varies by browser and it is best not to depend on its behaviour.