0

I have issue regarding Google captcha auto load. Google captcha gave me source according to the onclick function but I'm weak in Javascript and can't modify in the autoload function. Can anyone guide me how can I change autoload function when page load captcha auto show? The important thing is that I'm using fancybox ajax option that is why I have some complications. The code mentioned:

<script type="text/javascript" src="http://www.google.com/recaptcha/api/js/recaptcha_ajax.js"></script>
<script type="text/javascript">
function showRecaptcha() {
        Recaptcha.create("6Lcxj-ASAAAAAJ-OV2Sw40GfzbODQNLOTKuEFPbU", 'captchadiv', {
        tabindex: 1,
        theme: "clean",
        callback: Recaptcha.focus_response_field
        });
}     
</script>

<div id="captchadiv"></div>

<input type="button" value="Change reCAPTCHA" onclick="showRecaptcha('captcha_div');"></input>
4

1 回答 1

1

In ajax put Recaptcha.reload() as shown in following code

 $.ajax({ 
         type: 'POST', 
         url: "../yourpath", 
         data: $("#signupForm").serialize(), 
         datatype: "json", 

         success: function (response) {
             alert(response.message);
             if(response.message=="Captcha invalid"){

                   Recaptcha.reload();
                             }
         }, 
         error:  function(response, ajaxOptions, thrownError) {
             alert("Some problem in saving the record : " + response.message);
         }
    });
于 2013-05-08T10:42:26.170 回答