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.
This commit is contained in:
parent
19a2194704
commit
deb07487bd
13
js/util.js
13
js/util.js
|
@ -166,14 +166,20 @@ $(document).ready(function(){
|
||||||
$("#notice_action-submit").addClass("disabled");
|
$("#notice_action-submit").addClass("disabled");
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
timeout: '60000',
|
||||||
error: function (xhr, textStatus, errorThrown) { $("#form_notice").removeClass("processing");
|
error: function (xhr, textStatus, errorThrown) { $("#form_notice").removeClass("processing");
|
||||||
$("#notice_action-submit").removeAttr("disabled");
|
$("#notice_action-submit").removeAttr("disabled");
|
||||||
$("#notice_action-submit").removeClass("disabled");
|
$("#notice_action-submit").removeClass("disabled");
|
||||||
if ($(".error", xhr.responseXML).length > 0) {
|
if (textStatus == "timeout") {
|
||||||
$('#form_notice').append(document._importNode($(".error", xhr.responseXML).get(0), true));
|
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 {
|
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) {
|
success: function(xml) { if ($("#error", xml).length > 0) {
|
||||||
|
@ -189,7 +195,6 @@ $(document).ready(function(){
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
li = $("li", xml).get(0);
|
li = $("li", xml).get(0);
|
||||||
id = li.id;
|
|
||||||
if ($("#"+li.id).length == 0) {
|
if ($("#"+li.id).length == 0) {
|
||||||
$("#notices_primary .notices").prepend(document._importNode(li, true));
|
$("#notices_primary .notices").prepend(document._importNode(li, true));
|
||||||
$("#notices_primary .notice:first").css({display:"none"});
|
$("#notices_primary .notice:first").css({display:"none"});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user