summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSarven Capadisli <csarven@controlyourself.ca>2009-05-01 17:00:36 +0000
committerSarven Capadisli <csarven@controlyourself.ca>2009-05-01 17:00:36 +0000
commitdeb07487bd0802fa6a89cfc8ddd56af93945eb4c (patch)
tree3ce6decbb8d8f28501c079ac5f39b730a50aea0e
parent19a21947046062fc0cc313b23ae7418d317def89 (diff)
60 seconds hard timeout for XHR notice posting. JavaScript throws an
alert message to the client if the server doesn't respond back in any way.
-rw-r--r--js/util.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/js/util.js b/js/util.js
index f15c4f2bb..3f14bc61c 100644
--- a/js/util.js
+++ b/js/util.js
@@ -166,14 +166,20 @@ $(document).ready(function(){
$("#notice_action-submit").addClass("disabled");
return true;
},
+ timeout: '60000',
error: function (xhr, textStatus, errorThrown) { $("#form_notice").removeClass("processing");
$("#notice_action-submit").removeAttr("disabled");
$("#notice_action-submit").removeClass("disabled");
- if ($(".error", xhr.responseXML).length > 0) {
- $('#form_notice').append(document._importNode($(".error", xhr.responseXML).get(0), true));
+ if (textStatus == "timeout") {
+ alert ("Sorry! We had trouble sending your notice. The servers are overloaded. Please try again, and contact the site administrator if this problem persists");
}
else {
- alert("Sorry! We had trouble sending your notice ("+xhr.status+" "+xhr.statusText+"). Please report the problem to the site administrator if this happens again.");
+ if ($(".error", xhr.responseXML).length > 0) {
+ $('#form_notice').append(document._importNode($(".error", xhr.responseXML).get(0), true));
+ }
+ else {
+ alert("Sorry! We had trouble sending your notice ("+xhr.status+" "+xhr.statusText+"). Please report the problem to the site administrator if this happens again.");
+ }
}
},
success: function(xml) { if ($("#error", xml).length > 0) {
@@ -189,7 +195,6 @@ $(document).ready(function(){
}
else {
li = $("li", xml).get(0);
- id = li.id;
if ($("#"+li.id).length == 0) {
$("#notices_primary .notices").prepend(document._importNode(li, true));
$("#notices_primary .notice:first").css({display:"none"});