我的网站上有一个自动完成框。 我正在使用Tokeninput 。 如果没有结果,我会让用户点击链接添加它。 问题是,如果他们已经输入了已经缓存的确切查询,那么他们必须刷新页面以在下拉列表中查看结果。 反正有没有阻止某些ajax调用的缓存?
I have an auto complete box on my site. I'm using Tokeninput. When there isn't a result I have users click a link to add it. The problem is that if they've already typed the exact query that's already been cached, so they have to refresh the page to see the result in the drop down. Is there anyway to prevent caching of certain ajax calls?
最满意答案
将jQuery.ajax的cache选项设置为false 。 这将阻止AJAX调用的缓存。 它的工作原理是添加一个名为_的新查询字符串参数,该参数设置为当前时间戳。
Set the cache option in jQuery.ajax to false. This will prevent the caching of AJAX calls. It works by adding a new query-string parameter called _, which is set to the current timestamp.
更多推荐
Tokeninput,result,缓存,ajax,电脑培训,计算机培训,IT培训"/> <meta name="des
发布评论