我想创建一个具有 id 为“captcha”的 div 的表单。当用户输入错误密码时,“login.php”中会生成以下代码
$myCaptcha=recaptcha_get_html($publickey, $error);
$xml="<captcha><![CDATA[".$myCaptcha ."]]></captcha>";
echo $xml;
recaptcha_get_html($publickey, $error);
生成这个:
<script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k=xxxx"></script> <noscript> <iframe src="http://www.google.com/recaptcha/api/noscript?k=xxxx" height="300" width="500" frameborder="0"></iframe><br/> <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/> </noscript>
我想使用 $.post() 获取此代码并将其插入 div“验证码”。做这样的事情:
$.post("login.php", {requestCaptcha:"yes"}, function(returned){
$("#captcha").html($("captcha",returned).text());
},"xml");
在 IE 中,它什么也不做。在 Chrome 中,它清除了整个页面,只有调用的 reCaptcha 脚本像一个魅力一样工作。
有任何想法吗?