0
我有一个返回XML的web服务。即获得XML使用jQuery显示AJAX请求的结果
代码:
function PostToService()
{
$.ajax({
type: 'POST',
url: "http://localhost:53247/api/student/studentstatus",
dataType: 'xml',
data: "<StudentStatus><ID>C101</ID><Score>56</Score></StudentStatus>",
contentType: "text/xml",
Accept: "text/xml",
success: function (data) {
console.log(data);
}
});
我可以看到Devtools控制台返回的XML扩展#document:
<UpdatedStudent>
<StudentID>C101</StudentID>
<Result>Pass</Result>
<UpdatedStudent>
尝试创建与响应的ID的股利和使用该代码:
$("#response").html(data);
在控制台中获取此错误:
Cannot read property 'ownerDocument' of null
如何向用户显示响应?
在此先感谢。