reCaptcha and lightbox and ajaxPost
14 September 2012
sometimes, you want to do lightbox for Email Us or Contact Us page.
in this case, you don't want to include the recaptcha js in every page, you want to include it in the popup lightbox but here we have an issue that $(document).ready would be called while the google recaptcha js is not loaded. b/c document ready is just checking the original page instead of the lightbox. in this case, here is a common solution for every js loading (wait until that js loaded.)
and only after it's loaded, we clear the check, and create the catpcha.
the trick works pretty good. but here is another issue, when the lightbox is loaded and user submits the form, and if some elements are wrong or captcha is wrong, that we need show captcha once again. it will be broken. b/c Recaptcha js variable is already defined, and Recaptcha.create will not working fine b/c it has something stored for previous captcha.
in this case, another tricky is much more simpler.
those issue only happens on ajax lightbox load reCaptcha and ajaxPost the reCaptcha form.
stupid but works.
blog comments powered by Disqus