Jquery autocomplete :: clear cache

I use jquery autocomplete for two fields: Country and State. I want the state list to match the value of the country, and I get this too.

My problem is that autocomplete status also shows the result of a previous search in a country. I know this is due to the result of the jquery cache.

Someone please call me how to solve this problem.

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 advance

+3
source share
3 answers

This should work:

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

It will clear the cache after choosing a country.

+3
source

You can do it this way. you can install everythig .... try .........

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

    });
+1
source

$( "# " ) unautocomplete();.

$( "# " ) (NewData);.

0

Source: https://habr.com/ru/post/1753942/


All Articles