Explorar o código

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 %!s(int64=9) %!d(string=hai) anos
pai
achega
69ef214c92
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      src/js/select2/data/ajax.js

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

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