English 中文(简体)
清除 Jquery ui 自动完成的缓存
原标题:Clear the cache for jquery ui autocomplete

我想我读过所有关于这个问题的 堆积流和谷歌结果, 它们似乎都是指第一个 jquery 自动完成插件, 而不是当前的 jquery ui 自动完成 。

强制自动完整的结果从数据源更新而不是从缓存列表更新的方法是什么?

最佳回答

jquery ui 自动完成不做任何缓存。 缓存正在浏览器级别发生。 为了防止它发生, 请使用 < code>$. ajaxSetup

$.ajaxSetup({ cache: false });

如果您不想在全球禁用缓存, 您也可以转而向源选项提供一个函数, 该函数可以使用 < code> cache () 为您提供 ajax 请求 : 假的

source: function(request, response) {
    $.ajax({
        url: "url.php",
        dataType: "json",
        cache: false,
        type: "get",
        data: { term: request.term }
    }).done(function(data) {
        response(data);
    });
}
问题回答

您也可以在 jQuery 界面 使用的源词url 中添加随机 < a href=>。 jQuery UI 足够聪明, 如果已经存在缓存断断开参数, 可以处理附加术语参数 。





相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签