开发者

Jquery autocomplete :: clear cache

开发者 https://www.devze.com 2023-01-06 11:42 出处:网络
I am using Jquery autocomplet for two fields, Country and state. I want the states list according to country value and I am getting this too.

I am using Jquery autocomplet for two fields, Country and state. I want the states list according to country value and I am getting this too.

My problem is that state auto complete also show the result of previous country seach. I know this is because jquery cache the result.

Some one please guide me how to solve this

My code is below

$('#khk_adressen_LieferLand').autocomplete("/countries/auto_complete_for_countries_list",{
flushCache: function() {
     return this.trigger("flushCache");
  }
});


$('#khk_adressen_LieferPLZ').autocomplete("/postals/auto_complete_for_postals_list", {
               flushCache: function() {
     return this.trigger("flushCache");
  },
  extraParams: {
      country_name: function() { return $("#khk_adressen_LieferLand").val(); }
  }

});

Thansk in advan开发者_如何转开发ce


This should work:

$("#country_id").result(function()
{
    $("#state_id").flushCache();
});

It will clear the cache after they select the country.


You can do it by this way. you can set everythig....try.........

 $("#setcommonelement_ElementName").autocomplete(data, {
        minChars: 0,
        width: 262,
        matchContains: "word",
        scrollHeight: 220,    
        cacheLength: 0

    });


$("#element").unautocomplete();

$("#element").autocomplete(newData);

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号