diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-10-02 10:21:52 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-10-02 10:21:52 -0400 |
commit | 5405a821b9d13daa11a2e66866fe8b16e7b68177 (patch) | |
tree | 4daacc8743e5c969e0de17917acb153492ce2d27 /demos/autocomplete | |
parent | 2c50b1b8b58bc7ca6a965e4deff480a1c733766b (diff) | |
download | jquery-ui-5405a821b9d13daa11a2e66866fe8b16e7b68177.tar.gz jquery-ui-5405a821b9d13daa11a2e66866fe8b16e7b68177.zip |
Autocomplete cache demo: Let the widget handle request synchronization. Fixes #8616 - Remote autocomplete example can leave pending request tracking out of sync.
Diffstat (limited to 'demos/autocomplete')
-rw-r--r-- | demos/autocomplete/remote-with-cache.html | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/demos/autocomplete/remote-with-cache.html b/demos/autocomplete/remote-with-cache.html index 6f25c5534..bc1de7746 100644 --- a/demos/autocomplete/remote-with-cache.html +++ b/demos/autocomplete/remote-with-cache.html @@ -18,8 +18,7 @@ </style> <script> $(function() { - var cache = {}, - lastXhr; + var cache = {}; $( "#birds" ).autocomplete({ minLength: 2, source: function( request, response ) { @@ -29,11 +28,9 @@ return; } - lastXhr = $.getJSON( "search.php", request, function( data, status, xhr ) { + $.getJSON( "search.php", request, function( data, status, xhr ) { cache[ term ] = data; - if ( xhr === lastXhr ) { - response( data ); - } + response( data ); }); } }); |