diff options
Diffstat (limited to 'js/util.js')
-rw-r--r-- | js/util.js | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/js/util.js b/js/util.js index 53e6eb792..15a14625c 100644 --- a/js/util.js +++ b/js/util.js @@ -166,6 +166,16 @@ $(document).ready(function(){ $("#notice_action-submit").addClass("disabled"); return true; }, + 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)); + } + 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) { var result = document._importNode($("p", xml).get(0), true); result = result.textContent || result.innerHTML; @@ -192,10 +202,8 @@ $(document).ready(function(){ $("#notice_action-submit").removeClass("disabled"); } }; - if (document.body.id != 'inbox' && document.body.id != 'outbox') { - $("#form_notice").ajaxForm(PostNotice); - $("#form_notice").each(addAjaxHidden); - } + $("#form_notice").ajaxForm(PostNotice); + $("#form_notice").each(addAjaxHidden); NoticeHover(); NoticeReply(); }); |