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
如何向用戶顯示響應?
在此先感謝。