jQuery を使用してフォームを投稿および処理しようとしています。
<form action="/postcomment/" method="post" id="commentform">
<input type="text" name="author" id="author" />
<input type="text" name="email" id="email" />
<textarea name="comment" id="comment" ></textarea>
<input name="submit" type="submit" id="submit" value="Submit" />
</form>
そしてjQueryコード:
$("#submit").click(function() {
$.ajax({
dataType: 'json',
beforeSend: function() {
},
timeout: 60000,
error: function(request,error) {
},
success: function(data) {
var obj = jQuery.parseJSON(data);
//blah blah...
} // End success
}); // End ajax method
return false;
});
期待どおりに動作します。ただし、フォームに追加すると<script type="text/javascript" src="https://www.google.com/recaptcha/api/challenge?k=xxxx" > </script>
、機能しなくなります。
ブラウザは、次のように尋ねます: json ファイルがあります。それを開きますか?
明らかに、recaptcha スクリプトは「投稿」アクションを呼び出します。Recaptcha がフォームで「アクション」を実行しないようにするにはどうすればよいですか?