之间$就差({缓存:假});和$ .ajaxSetup({缓存:假}); jQuery中,哪一个是最好的选择 [英] Difference between $.ajax({cache:false}); and $.ajaxSetup({cache:false}); in jQuery and which one is best option
本文介绍了之间$就差({缓存:假});和$ .ajaxSetup({缓存:假}); jQuery中,哪一个是最好的选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是初学者在Ajax和想知道的 $区别的ajax({缓存:假});
和 $ ajaxSetup ({缓存:真}); jQuery中,哪一个是最好的选择
?
I am begginer in ajax and would like to know the difference between $.ajax({cache:false});
and $.ajaxSetup({cache:true});
in jQuery and which one is best option?
推荐答案
下面将prevent 所有未来AJAX被缓存的要求,无论哪个jQuery的方法,使用($不用彷徨,$就等)
The following will prevent all future AJAX requests from being cached, regardless of which jQuery method you use ($.get, $.ajax, etc.)
$(document).ready(function() {
$.ajaxSetup({ cache: false });
});
你应该使用$阿贾克斯,这将允许你关闭缓存为例如:
$.ajax({url: "myurl", success: myCallback, cache: false});
这篇关于之间$就差({缓存:假});和$ .ajaxSetup({缓存:假}); jQuery中,哪一个是最好的选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文