在使用jQuery做AJAX请求的时候,如何防止AJAX在缓存中调用数据呢?
- 参数type由get改成post
- 添加参数cache并设置成false
- 添加时间戳
参考代码如下:
$.ajax({
url: 'ios/index',
cache: false,
type: 'post',
data: {
timestamp: new Date().getTime()
//params here
},
dataType: 'json'
}).done(function (data) {
//codes here
});