Note that there are some explanatory texts on larger screens.

plurals
  1. POrecaptcha: difficulty with the verify
    primarykey
    data
    text
    <p>I'm trying to implement a recaptcha. I'm calling the verify script (http://www.google.com/recaptcha/api/verify) with jquery (ajax). This limits the data type to JSONP, google rejects all other data types.</p> <p>the problem is that the google verify return strings like so: true success</p> <p>or false 'error message'</p> <p>this results in a parse error on the jquery side... Does anyone have any idea how I can resolve this or worst case scenario retrieve the responsetext even if there is a parse error?</p> <p>the following is my ajax request. I added the complete and error functions for testing.</p> <pre><code>$("#verifyCaptcha").click(function(){ var chal = Recaptcha.get_challenge(); var resp = Recaptcha.get_response(); $.ajax({ url: "http://www.google.com/recaptcha/api/verify", type: "GET", data: { privatekey: "MyKey", remoteip: "172.29.129.133", challenge: chal, response: resp }, //dataType: 'jsonp', success: function(output){ output = output.split('/n'); console.log(output[0] + '**' + output[1]); if(output[0].toLowerCase() == 'true') $("#recaptcha_result").html('Succes: form will be sent.'); else $("#recaptcha_result").html('Failed: form will NOT be sent.'); }, complete:function (xhr, status) { if (status === 'error' || !xhr.responseText) console.log('an error occured'); else var data = xhr.responseText; }, error: function(request, status, error) { if(request.responseText == 'success') $("#recaptcha_result").html('Succes: form will be sent.'); else $("#recaptcha_result").html('Failed: form will NOT be sent.'); console.log(request.responseText + '**'+status + "**"+error); } }); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload