summaryrefslogtreecommitdiff
path: root/js/reader.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2020-09-22 15:25:24 +0300
committerAndrew Dolgov <[email protected]>2020-09-22 15:25:24 +0300
commit2df368d49228ed4529a06501fdc5c2ce8eb631d5 (patch)
tree301a53114d416fbd37d67eafa4b41a7fa4edebdc /js/reader.js
parent7349c8fbae44928924293219df8f3c80794e8ff3 (diff)
show dictionary popup before request completes
Diffstat (limited to 'js/reader.js')
-rw-r--r--js/reader.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/js/reader.js b/js/reader.js
index e71d157..99ff269 100644
--- a/js/reader.js
+++ b/js/reader.js
@@ -941,15 +941,21 @@ const Reader = {
lookupWord: function(word, callback) {
word = word.replace(/­/g, "");
+ $(".dict_result").html('Loading, please wait...');
+
+ $("#dict-modal").modal('show');
+
$.post("backend.php", {op: 'define', word: word}, function (data) {
if (data) {
$(".dict_result").html(data.result.join("<br/>"));
$(".dict_query").val(word);
- $("#dict-modal").modal('show');
if (callback) callback();
}
+ }).fail(function(res) {
+ console.warn(res);
+ $(".dict_result").html('Network error while looking up word: ' + res.statusText);
});
},
search: function() {