I am working on a comment script using ajax, json and jquery.
I have most of it done except the hardest part,
If a user post X ammount of comments in X ammount of time, my php script will return a "captcha" trigger to my javascript code below, telling it that this user needs to enter a captcha code before we will post there comment to the DB
Below you will see I have 3 options for a returned value: success, error, and captcha
when captcha is returned, I want to open up a popup dialog on the screen and load my captcha script, so far everything works up to this point.
Now I need to make the captcha script submit, not only the captcha value but also my users comment, so I just need to populate a hidden form field with the comment value. Easy enough I just havent done it yet. Now if a user get the wrong captcha value, it needs to reload the screen but popup the captcha screen again and still have the comment hidden in a form value. That is where the tricky part comes in.
After reading my plan and viewing my code below, do you think I am on the right track? Any suggestions on a better way?
**UPDATE:**
After more thought it seems I need to make my captcha use ajax as well or else there will be a page reload =( @jasondavis - You should edit your previous similar question and put a bounty on it. stackoverflow.com/questions/1257991/…
以上就是Best way to do captcha with an Ajax form in jquery?的详细内容,更多请关注web前端其它相关文章!