有如下代码
$.ajax({
type: "GET",
cache: true,
url: 'aa.php',
dataType: "html",
success: function (res) {
$('.page-loading').remove();
$('.page-content .page-content-body').html(res);
});
发现 请求为
aa.com/aa.php
aa.com/aa.css
aa.com/aa.js?_=1373600904652
这样好像 js 文件不被缓存
请问有没有方法去掉 _=1373600904652 ???
昨晚研究了下这个问题,知道怎么回事了,在你的 ajax 请求前加一段代码:
同时你的那句
cache: true
可以省略,因为默认就是cache: true
,只有dataType
为"script"
和"jsonp"
时cache
默认为false
。你在此处加的cache: true
其实只影响了aa.php
的缓存与否。