Reputation: 13049
I do not want the requested page to be cached by the browser. Would a post request fix this? Is there much downside to making a POST instead of a GET?
At the moment I am using like:
$.get("/Client/JSON_GetInvoiceLines/" + ClientID, function (data) {
//do stuff
});
Upvotes: 1
Views: 247
Reputation: 473
you can use the cache
option in jQuery.
$.ajax({
url: '/Client/JSON_GetInvoiceLines/',
type: 'GET',
cache: false,
success: function(data){
// do stuff
}
});
It will append a random character string as a GET parameter to the end of your URL, so the browser won't cache it.
However, the ideal solution would be to disable caching on the server-side by setting headers, assuming you have control over the resource that you're requesting.
Upvotes: 2