问题
When I try to make a jquery ajax "Type:Post" request, I get an 404 not found (from cache) error. I've tried several workarounds to fix this problem but it doesn't worked. This are the workarounds I've tried:
Adding header information in ajax call: "Cache-Control" : "private, no-cache, no-store, must-revalidate", "Expires" : "0",
jquery ajax "cache:false"
add rnd URL param,
"?nocache=' + new Date().getTime()",tried to disable AppCache (nativ):
"super.appView.getSettings().setAppCacheEnabled(false);"
This is the response I get from this POST request when I debug my Cordova App with dev tools: http://pl.vc/59s6o
回答1:
Try setting your headers in the $.ajaxSetup
$.ajaxSetup({
type: 'POST',
headers: { "cache-control": "no-cache" }
});
We can help you more if you tell us more about your situation and include your code.
来源:https://stackoverflow.com/questions/23392351/prevent-post-request-from-caching