这是我的代码
$.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),注意contents
、converters
。
关于jquery - 未捕获的类型错误 : Cannot read property 'ownerDocument' of null on jquery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22984055/