在Ajax中使用Get请求数据不会有页面缓存的问题,而使用POST请求可是有时候页面会缓存 我们提交的信息,导致我们发送的异步请求不能正确的返回我们想要的数据
$. post(url,data , ranNum:Math, random()} ,function(data){})
ranNum :这个是防止缓存的核心,每次发起请求都会用Math, random()方法生成一个随机的 数字,这样子就会刷新"1缓存

Was this helpful?

0 / 0

发表回复 0

Your email address will not be published.