我通过以下代码收到错误:
jQuery.post('/user/result/generate',{
'id': getHidden()
}, function(html) {
$('#result').html(html);
});
错误:
TypeError object doesn't support this property or method
这段代码在 FireFox 中工作正常,但在 IE 中不行。
我该如何解决这个问题?
附注
函数 getHidden() 将返回选定的项目 ID,它工作得很好。我可以看到这个工作!
我把alert()放在这个函数中......像这样:
jQuery.post('/user/result/generate',{
'id': getHidden()
}, function(html) {
alert(html);
$('#result').html(html);
});
function getHidden(){
alert($("#selectId").val());
return $("#selectId").val();
}
我很好地得到了 selectId!但不是 html,所以这个函数停在 function(html) 处,从而停在响应处! 我在这个函数中放入try catch,得到错误: TypeError 对象不支持此属性或方法
但是按F5刷新页面后这个功能可以正常工作......所以我不明白为什么这个功能不是直接工作而是在刷新后工作......
最佳答案
解决了!我将脚本放在 html 文件底部,现在 FF 和 IE 都可以使用。
关于javascript - IE 的 JQuery 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3944939/