From b20ac7a1fefe40e82b086df3128f06770c8b550d Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 8 Jun 2009 20:45:44 +0000 Subject: Clearing notice_data-test and resetting notice_text-count if the notice XHR response is empty and have a 20x,30x HTTP status --- js/util.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/util.js b/js/util.js index 763c7d7ee..b59018fe5 100644 --- a/js/util.js +++ b/js/util.js @@ -167,6 +167,7 @@ $(document).ready(function(){ return true; }, timeout: '60000', + url: 'http://dev.controlyourself.ca/csarven/asdfasdfasdfasdf', error: function (xhr, textStatus, errorThrown) { $("#form_notice").removeClass("processing"); $("#notice_action-submit").removeAttr("disabled"); $("#notice_action-submit").removeClass("disabled"); @@ -178,10 +179,14 @@ $(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); + var HTTP20x30x = [200, 404, 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."); } + else { + $("#notice_data-text").val(""); + counter(); + } } } }, -- cgit v1.2.3 From c5378beb8355b0d5773d8464077fce70dd778026 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 8 Jun 2009 20:50:13 +0000 Subject: Revert "Clearing notice_data-test and resetting notice_text-count if the notice XHR" This reverts commit b20ac7a1fefe40e82b086df3128f06770c8b550d. --- js/util.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/js/util.js b/js/util.js index b59018fe5..763c7d7ee 100644 --- a/js/util.js +++ b/js/util.js @@ -167,7 +167,6 @@ $(document).ready(function(){ return true; }, timeout: '60000', - url: 'http://dev.controlyourself.ca/csarven/asdfasdfasdfasdf', error: function (xhr, textStatus, errorThrown) { $("#form_notice").removeClass("processing"); $("#notice_action-submit").removeAttr("disabled"); $("#notice_action-submit").removeClass("disabled"); @@ -179,14 +178,10 @@ $(document).ready(function(){ $('#form_notice').append(document._importNode($(".error", xhr.responseXML).get(0), true)); } else { - var HTTP20x30x = [200, 404, 201, 202, 203, 204, 205, 206, 300, 301, 302, 303, 304, 305, 306, 307]; + 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."); } - else { - $("#notice_data-text").val(""); - counter(); - } } } }, -- cgit v1.2.3 From 67cb99c4428f71a19187ccc0b8ac6ad0f129b325 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 8 Jun 2009 20:52:27 +0000 Subject: Clearing notice_data-test and resetting notice_text-count if the notice XHR. Removed hanging text URL from previous commit. --- js/util.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/util.js b/js/util.js index 763c7d7ee..44c3002cd 100644 --- a/js/util.js +++ b/js/util.js @@ -178,10 +178,14 @@ $(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); + var HTTP20x30x = [200, 404, 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."); } + else { + $("#notice_data-text").val(""); + counter(); + } } } }, -- cgit v1.2.3 From d9e5cda35d466ac1a428fffb72cc142922d4c211 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Tue, 9 Jun 2009 00:09:44 +0000 Subject: Removed 404 test --- js/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/util.js b/js/util.js index 44c3002cd..23abba6c2 100644 --- a/js/util.js +++ b/js/util.js @@ -178,7 +178,7 @@ $(document).ready(function(){ $('#form_notice').append(document._importNode($(".error", xhr.responseXML).get(0), true)); } else { - var HTTP20x30x = [200, 404, 201, 202, 203, 204, 205, 206, 300, 301, 302, 303, 304, 305, 306, 307]; + var HTTP20x30x = [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."); } -- cgit v1.2.3