Browse Source

Display error message on AJAX errors

This display the `errorLoading` translation when there is an error
during the AJAX cycle. Previously we were just throwing these errors
out, now we are actually displaying an error message.

This closes https://github.com/select2/select2/issues/3501
Kevin Brown 9 years ago
parent
commit
69ef214c92
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/js/select2/data/ajax.js

+ 3 - 1
src/js/select2/data/ajax.js

@@ -80,7 +80,9 @@ define([
 
 
         callback(results);
         callback(results);
       }, function () {
       }, function () {
-        // TODO: Handle AJAX errors
+        self.trigger('results:message', {
+          message: 'errorLoading'
+        });
       });
       });
 
 
       self._request = $request;
       self._request = $request;