summaryrefslogtreecommitdiff
path: root/lib/js/urweb.js
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-02-15 11:33:53 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-02-15 11:33:53 -0500
commite7fdb6e0f6ab265f3cd850d3663a91b531de8ba8 (patch)
tree33b3f75fb6281eca4712436ac1af5d2a8da69c75 /lib/js/urweb.js
parent1c32b54159daace88a762732bc6aecbd9801fcc2 (diff)
Detect AJAX call failures
Diffstat (limited to 'lib/js/urweb.js')
-rw-r--r--lib/js/urweb.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 9dd4dbbe..bfca94a4 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -133,8 +133,19 @@ function rc(uri, k) {
var xhr = getXHR();
xhr.onreadystatechange = function() {
- if (xhr.readyState == 4)
- k(xhr.responseText);
+ if (xhr.readyState == 4) {
+ var isok = false;
+
+ try {
+ if (xhr.status == 200)
+ isok = true;
+ } catch (e) { }
+
+ if (isok)
+ k(xhr.responseText);
+ else
+ alert("Error querying remote server!");
+ }
};
xhr.open("GET", uri, true);