From 69ef214c9220b5706ee40de1efb7b30b2f5414d7 Mon Sep 17 00:00:00 2001 From: Kevin Brown Date: Mon, 4 Jan 2016 20:07:37 -0500 Subject: [PATCH] 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 --- src/js/select2/data/ajax.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/js/select2/data/ajax.js b/src/js/select2/data/ajax.js index c2cc8d6a..92b9e1dd 100644 --- a/src/js/select2/data/ajax.js +++ b/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;