X-Git-Url: https://disinclined.org/git/?a=blobdiff_plain;f=includes%2Fajax.js;h=bc51be3ccd4163b40bdab49ef2d331de886a20cd;hb=c30849c73508b5a0168b6559b9935115186a20c7;hp=afc73e8dd4cb890df9d22ec3382a50978c2e467b;hpb=becd62fb957da0c16c4432c40cd818ea36e71828;p=dylansserver.git diff --git a/includes/ajax.js b/includes/ajax.js index afc73e8..bc51be3 100644 --- a/includes/ajax.js +++ b/includes/ajax.js @@ -1,4 +1,5 @@ $(document).ready(function() { + $('#recaptcha_widget').show(); $('.submit').click(function() { if ($('#comment_text').val() != '') { var challenge = Recaptcha.get_challenge(); @@ -14,6 +15,7 @@ $(document).ready(function() { var name = $("#comment_name").val(); var email = $("#comment_email").val(); var text = $("#comment_text").val(); + if (name == '') { name = "anon" } var comment_data = { "captcha" : "passed", "name" : name, "email" : email, @@ -34,7 +36,8 @@ $(document).ready(function() { } }); } else { - console.log('reCAPTCHA said you\'re not human.'); + var error = "reCAPTCHA said you're not human"; + $('#comment').append(error); } }, error: function() { @@ -45,7 +48,8 @@ $(document).ready(function() { } }); } else { - console.log('but you didn\'t write anything!'); + var error = "but you didn't write anything!
"; + $('#submit').before(error); } return false; });