有没有办法阻止某些URL的缓存?(Is there a way to prevent caching of certain URLs?)

编程入门 行业动态 更新时间:2024-10-27 13:27:41
没有办法阻止某些URL的缓存?(Is there a way to prevent caching of certain URLs?)

我的网站上有一个自动完成框。 我正在使用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

本文发布于:2023-07-24 08:01:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1243444.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:没有办法   缓存   URL   URLs   prevent

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!