diff options
author | Scott González <scott.gonzalez@gmail.com> | 2010-11-30 22:19:20 -0500 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2010-11-30 22:19:20 -0500 |
commit | 40135bb09130a56aabc0d185b62a597cb45df0dc (patch) | |
tree | 7b9fe9a64b7b26a08bc48393ab551d34bfe4fcd8 /ui | |
parent | ddb4694cc1b4edcbff6a2abedccde027e47dcbc3 (diff) | |
download | jquery-ui-40135bb09130a56aabc0d185b62a597cb45df0dc.tar.gz jquery-ui-40135bb09130a56aabc0d185b62a597cb45df0dc.zip |
Autocomplete: Handle ajax errors and timeouts. Fixes #6692 - Autocomplete: ui-autocomplete-loading class not removed when Ajax request times out.
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.autocomplete.js | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 80132e2d1..6aefe87d6 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -245,11 +245,22 @@ $.widget( "ui.autocomplete", { if (self.xhr) { self.xhr.abort(); } - self.xhr = $.getJSON( url, request, function( data, status, xhr ) { - if ( xhr === self.xhr ) { - response( data ); + self.xhr = $.ajax({ + url: url, + data: request, + dataType: "json", + success: function( data, status, xhr ) { + if ( xhr === self.xhr ) { + response( data ); + } + self.xhr = null; + }, + error: function( xhr ) { + if ( xhr === self.xhr ) { + response( [] ); + } + self.xhr = null; } - self.xhr = null; }); }; } else { |