jquery - 未捕获的类型错误 : Cannot read property 'ownerDocument' of null on jquery

标签 jquery

这是我的代码

$.ajax({
       url: "http://localhost:42046/WebService1.asmx/HelloWorld",
       type: 'get',
       success: function (data) {
       $("#fillme").html(data);
      }
});

当我删除 $("#fillme").html(data); 时,错误消失。

html

<span id="fillme"></span>

最佳答案

问题似乎出在从 Web 服务解析 xml 时。 只需在浏览器中执行 http://localhost:42046/WebService1.asmx/HelloWorld 即可看到它。我建议检查您的网络服务并使其以正确的格式返回数据(我不确定您到底需要什么,但它看起来像字符串)。另外尝试更改$.ajax参数(api.jquery.com/jQuery.ajax),注意contentsconverters

关于jquery - 未捕获的类型错误 : Cannot read property 'ownerDocument' of null on jquery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22984055/

相关文章:

jquery - jquery.html 的垃圾收集

javascript - 奇怪的冒泡问题

php - 使用 jQuery 重新设计表单样式?

jquery - 使用分区的滑动菜单

javascript - 如何检查 ul 标签中的文本

javascript - 第一次成功加载 ajax 数据后按钮不起作用

javascript - 如何更改 chosen.js 中的警报语言?

javascript - 使用 jquery mobile 和 cordova 无法刷新可折叠 ListView 的标题

javascript - 在 .keypress 和删除上应用 CSS 和删除 CSS

javascript - 阻止视频在手机后台加载