尝试使用表单中的recaptcha序列化表单。
以下是我对表单进行序列化的方法:
var serializedform = $('form.af').serialize();
这是我的表单示例:
<form class = 'af'>
<input name='name' id = 'name'>
<input name='lastname' id = 'lastname'>
<div id = 'recaptchadiv'>
<input name='recaptcha_response_field' id = 'recaptcha_response_field'>
<input name='recaptcha_challenge_field' id = 'recaptcha_challenge_field'>
<noscript>
<input name='recaptcha_response_field' id = 'recaptcha_response_field'>
<input name='recaptcha_challenge_field' id = 'recaptcha_challenge_field'>
</noscript>
</div>
<button name = 'submit'>
</form>
问题来自recaptcha自动注入的recaptcha noscript块。 该块包含recaptcha_response_field和recaptcha_challenge_field的副本。
所以 - 当我序列化这个表单时 - 来自noscript块输入的值会覆盖真实的recaptcha_response_field和recaptcha_challenge_field值。
有没有办法在跳过noscript块时使用jquery序列化表单?
感谢:)