您的位置:首页 > Web前端 > JQuery

关于较新版本JQUERY的Load方法会为页面引用文件自动附加时间戳参数阻止它缓存的解决方案.

2016-10-27 09:34 561 查看
// More options handling for requests with no content

            if (!s.hasContent) {

                // If data is available, append data to url

                if (s.data) {

                    cacheURL = (s.url += (rquery.test(cacheURL) ? "&" : "?") + s.data);

                    // #9682: remove data so that it's not used in an eventual retry

                    delete s.data;

                }

                // Add anti-cache in url if needed

                if (s.cache === false) {

                    s.url = rts.test(cacheURL) ?

                    // If there is already a '_' parameter, set its value
cacheURL.replace(rts, "$1_=" + nonce++) :

                    // Otherwise add one to the end
cacheURL + (rquery.test(cacheURL) ? "&" : "?")  + "_=" + nonce++;

                }
            }

红色部分便是附加参数反缓存的代码,更改一下即可.  不明白为什么JQ强制加入这个,Load方法也不可以传参来改变 cache的值为True
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐