JQuery 错误提示:HierarchyRequestError: Node cannot be inserted at the specified point in the hierarchy
2013-11-12 17:27
633 查看
用JQuery的AJAX返回一些script脚本和html代码并运行这些代码,在测试的时候,发现在IE下正常,在火狐下并没有数据出现,通过调试,发现提示'Nodecannot be inserted at the specified point in thehierarchy'错误,百思不得其解,谷歌和百度均没有有效的解决办法。
通过查看JQuery的API。最终发现了问题所在。
下面是代码片段一,这段代码在IE下可以正常运行,但是在火狐下却提示脚本错误:
这段代码是通过URL返回一个javascript脚本段,并执行这个脚本。最终在IE下测试正常,但是在火狐和谷歌浏览器下发现无法执行脚本。但是在JQuery的API中看到有一个属性dataType,通过说明,明白需要指定dataType属性为html即可解决这个问题。
最终测试正确代码如下:
通过查看JQuery的API。最终发现了问题所在。
下面是代码片段一,这段代码在IE下可以正常运行,但是在火狐下却提示脚本错误:
function getReservationData(d, f,url){ jQuery.ajax({ type: "post", url: url, data: { searchdata: d, flashcontainer: f, a: Math.random() }, error: function (){ return false; }, success: function (data){ $("#" +f).html(data); } }); }
这段代码是通过URL返回一个javascript脚本段,并执行这个脚本。最终在IE下测试正常,但是在火狐和谷歌浏览器下发现无法执行脚本。但是在JQuery的API中看到有一个属性dataType,通过说明,明白需要指定dataType属性为html即可解决这个问题。
最终测试正确代码如下:
function getReservationData(d, f,url){ jQuery.ajax({ type: "post", url: url, data: { searchdata: d, flashcontainer: f, a: Math.random() }, dataType: 'html', error: function (){ return false; }, success: function (data){ $("#" +f).html(data); } }); }
相关文章推荐
- 峰回路转,Firefox 浏览器即将重返 iOS 平台
- 峰回路转,Firefox 浏览器即将重返 iOS 平台
- Mozilla Firefox试用杂感
- 用vbscript实现隐藏任务栏图标的脚本
- 浏览器 cookie 限制
- 用autoit编写第一个脚本(Hello World)
- VBS调用WMI快速关闭IE的脚本
- 玩转浏览器IE7的5个顶级使用技巧
- 收集的ROS防火墙脚本
- JSP脚本漏洞面面观
- 字符集导致的浏览器跨站脚本攻击分析
- 不错的批处理脚本 第一部分
- VBS脚本加密/解密VBS脚本(简易免杀版1.1)
- 不错的批处理脚本实例代码 第二部分
- 使用脚本和批处理清除电脑中的痕迹的代码第1/2页
- 让你的脚本说话
- 更改IE浏览器的图标