mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Autocomplete: Handle ajax errors and timeouts. Fixes #6692 - Autocomplete: ui-autocomplete-loading class not removed when Ajax request times out.
This commit is contained in:
parent
ddb4694cc1
commit
40135bb091
19
ui/jquery.ui.autocomplete.js
vendored
19
ui/jquery.ui.autocomplete.js
vendored
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user