Temporary workaround for silenting mysterious 200 OK error for XHR

notice posts.

The bug is sometimes reproduceable by sending a notice that includes
"@someusernamethatdoesntexist".

This patch doesn't throw alerts to user if server doesn't return with
an XHR response but HTTP is one of 20x, 30x.
This commit is contained in:
Sarven Capadisli 2009-06-08 18:55:23 +00:00
parent 265e2bd58d
commit a2ca9d96d2

View File

@ -178,9 +178,12 @@ $(document).ready(function(){
$('#form_notice').append(document._importNode($(".error", xhr.responseXML).get(0), true));
}
else {
var HTTP20x30x = new Array(200, 201, 202, 203, 204, 205, 206, 300, 301, 302, 303, 304, 305, 306, 307);
if(jQuery.inArray(parseInt(xhr.status), HTTP20x30x) < 0) {
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) {
var result = document._importNode($("p", xml).get(0), true);