I am working on a comment system on a social network, I am using jquery, I can post the comments with ajax with no problem but sometimes I need a user to submit a captcha form if they are posting too many comments or for other reasons.
I think the best way to do this is to add it into the current comment posting part, if the php script returns a response, stating that we need to do a captcha form, then I would like to auto open up a dialog window on the screen, let the user fill in the captcha form, then carry on and post there comment.
This is somewhat complex for me but I have most of it done I think, maybe you can read my comments below and help me with the captcha part, mainly on how I can trigger a dialog to open, how I can pass the comment value/text through the captcha and back to the comment backen again on sucess and also if the user gets the captcha wrong, then it will reload the captcha
$.ajax({
type: "POST",
url: "processing/ajax/commentprocess.php?user=",
data: args,
cache: false,
success: function (resp) {
if (resp == 'captcha') {
//they are mass posting so we need to give them the captcha form
// maybe we can open it in some kind of dialog like facebox
// have to figure out how I can pass the comment and user data to the captcha script and then post it
} else if (resp == 'error') {
// there was some sort of error so we will just show an error message in a DIV
} else {
// success append the comment to the page
};
}
});