浏览代码

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 年之前
父节点
当前提交
69ef214c92
共有 1 个文件被更改,包括 3 次插入1 次删除
  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;