今天遇到一个问题,更改代码之后,线上代码无效,检查代码发现还是原来的代码、没更新,那就只能不让缓存
用了两种方法
1.标签
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
2.ajax请求时,不允许缓存
$.ajax({
type: 'post',
url: "url,
cache:false, //不允许缓存
data: {
phone: phone
},
success: function(result) {
console.log(result.data)
},
error: function(result) {
console.log(result.data.msg)
}
});