Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript reCaptcha validation

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #37584
    Anonymous
    Inactive

    Ok. A huge noob here.
    Can’t finish my reCaptcha validation. I took the long road and wrote the script myself. here is the last part of it:

    	$("#submit").click(function(){

    $.get("http://www.google.com/recaptcha/api/verify", function(response){ //geting the response from google

    if (response ==""){ //problem HERE, AND MAYBE HIGHER
    $("#msg").empty(); //destroys the div's content
    $("#msg").append(""); //ads to the div a thankyou massage
    $("#recaptcha").empty(); //destroys captcha
    $.post("scripts/post.php",{ // posts the info from the form to...
    param1: $("#name").val(), //posted param1
    param2: $("#comment").val() //posted param2
    });
    }

    else {
    Recaptcha.reload("6LeP9c8SAAAAACfesF2T3n8zGAaDkK3M-N18QRS-", 'recaptcha', {
    tabindex: 1, theme: "red", callback: Recaptcha.focus_response_field
    });
    } //reloads recaptcha if there was a mistake in it

    });

    });

    THE QUESTION IS – WHAT STATEMENT SHOULD BE IN if(), so that it will say – ok – CAPTCHA WAS PASSED FINE, LETS GO ON.

    Google says – When you send a captcha to us, we reply in a string either “true” or “falsen-the-reason-why-you-failed.
    It also says – seperate the string in n and read only line1

    I’ve tried tons of stuff: regexp.test(response) and response.search(regexp) – where var regexp=’true’, and what not, can’t even remember now.

    Please, help)

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.