I'm using Google Captcha when some number of login attempts failed, my website is based on Ajax and Java Script so I need to load Google Captcha Java Script file when a function called!
I'm getting captcha code through making a request to my API, http://www.myserver.com/api/?request=captcha so this will return
<script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k=6LeV3rdSAAAAABp2Q3bjyjCR9E6vvZ06oM6-6yj"></script>
I use $POST to make the request and .HTML to show captcha on my site
$.post("api/index.php", {request: "captcha"}, function(data) {
$('#customContent').html(data);
});
but this doesn't show up captcha on the HTML element! Where am I doing wrong?
document.write()to insert it's content? If so, you can't insert that afterwards as it won't work.document.write()will only insert things into the current location in the document if it runs while the page is loading. Otherwise,document.write()clears the current document and starts a new one.