防止jQuery的ajax请求缓存里的数据

  1. 参数typeget改成post
  2. 添加参数cache并设置成false
  3. 添加时间戳
$.ajax({
    url: 'ios/index',
    cache: false,
    type: 'post',
    data: {
        timestamp: new Date().getTime()
        //params here
    },
    dataType: 'json'
}).done(function (data) {
    //codes here
});

 

你可能感兴趣的:(JavaScript)