2
我试图调试一些不适用于任何版本的Internet Explorer的东西。为什么这不适用于Internet Explorer? [jQuery,收音机,选择器]
下面的代码:该行(reponse = $('input[name=reponse]:checked').val();
)发生
<div id="sondage">
<input type="radio" name="reponse" value="oui" id="oui">
<label for="oui">Oui</label>
<input type="radio" name="reponse" value="non" id="non">
<label for="non">Non</label>
</div>
<script type="text/javascript" charset="utf-8">
$(function(){
$('#oui, #non').click(function(){
reponse = $('input[name=reponse]:checked').val();
sondage_id = <?php echo $sondage->id ?>;
$.ajax({
type: "GET",
url: "<?php echo url_for('@sondage_repondre') ?>",
data: "reponse="+reponse+"&id="+sondage_id,
success: function(msg){
resultat = msg.split('|');
if (resultat[0] == "true") {
$('#sondage_message').html("<?php echo __('Merci.') ?>");
} else {
$('#sondage_message').html("<?php echo __('Désolé, vous avez déjà voté pour ce sondage. Merci.') ?>");
}
$('#sondage').html(resultat[1]);
}
});
});
});
</script>
错误。
你知道发生了什么吗?
谢谢!
编辑:由于问:错误是:
Line 511, Char 7, Object doesn't support this property or method.
而这里的完整输出:再次http://pastie.org/1355610
谢谢!
你确定这是导致错误的那一行吗?我不信任IE的行号,但可以通过对该值进行硬编码来验证它,并查看它是否有效。你会得到什么错误?你能否用源代码更新你的问题(“查看源代码”)而不是实际的源代码? '<? PHP的回声是不是IE浏览器正在看到,所以这并没有帮助我们很多。如果`$ sondage-> id`产生一个字符串,或者一个空的值,例如,这将在任何浏览器上中断。 – 2010-12-07 14:25:07
你是完全正确的,我更新了这个问题。谢谢:) – TomShreds 2010-12-07 14:52:10