私はソーシャル ネットワークでコメント システムに取り組んでいます。jquery を使用しています。問題なく ajax でコメントを投稿できますが、コメントが多すぎる場合やその他の理由でユーザーがキャプチャ フォームを送信する必要がある場合があります。
これを行う最善の方法は、現在のコメント投稿部分に追加することだと思います.phpスクリプトが応答を返し、キャプチャフォームを実行する必要があることを示している場合は、画面で、ユーザーにキャプチャ フォームに入力してもらい、続けてそこにコメントを投稿します。
これは私にとってはやや複雑ですが、ほとんどのことは完了していると思います。おそらく、以下の私のコメントを読んで、主にダイアログを開いて開く方法、コメント値を渡す方法について、キャプチャの部分で私を助けてください/キャプチャを介してテキストを送信し、成功すると再びコメントに戻ります。また、ユーザーがキャプチャを間違えた場合は、キャプチャをリロードします
$.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
};
}
});