-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在app中使用,不起作用; #1
Comments
在一般的浏览器运行该逻辑有没效果呢? |
看起来也没有作用; |
1、你用的什么版本的jquery? 2、是不是按照这个顺序引入的?
|
|
全局需要先调用下 参考下面代码: <!DOCTYPE html>
<html>
<head>
<title>test jquery-ajax-cache</title>
<head>
<script src="js/jquery-1.9.1.min.js"></script>
<script src="js/jquery-ajax-cache.js"></script>
<script>
$ajaxCache.config();
$.ajax({
ajaxCache: {
cacheValidate: function(res, options) {
return true;
},
storageType: 'localStorage',
timeout: 30,
forceRefresh: false
},
type: "GET",
url: "https://api.github.com/repos/WQTeam/jquery-ajax-cache",
dataType: "json",
success: function(data) {
console.log(data);
}
})
</script>
</html> |
增加了$ajaxCache.config();之后,在PC上是可以了。 |
@wangxiaote ,应该有关系的。你打开cache试试。 |
调试的结果,storage.isSupported()是false; |
storageType: 'sessionStorage' 这样就可以了。 |
我在APP中写了一个webview,在其中加载网页;网页中有一个ajax请求,用于请求网页中需要显示的数据;这个数据我不想用户过于频繁的获取,一方面也不想缓存过久,所以就用了ajax-cache来做;但是看起来,每次请求都发出去了
$.ajax({
ajaxCache: {
cacheValidate: function (res, options) {
return true;
},
storageType: 'localStorage',
timeout: 30,
forceRefresh: false
},
type:"get",
url: "http:xxxxxx.xxxx.com",
async: true,
dataType:"json",
success:function(data) {
The text was updated successfully, but these errors were encountered: