성공 이벤트 처리기에서 XML 문서의 내용을 $ (this)로 출력 할 수 있습니까?jQuery : XML 문서의 내용을 노드로 어떻게 출력 할 수 있습니까?
var useJson = false;
var acceptHeader;
if (useJson) {
acceptHeader = "application/json";
} else {
acceptHeader = "text/xml"
}
$.ajax({
url: '<%= Url.Action("GetAllCategories") %>',
beforeSend: function (req) {
req.setRequestHeader("Accept", acceptHeader);
},
type: 'POST',
accepts: "application/json",
context: $("#divGetAllCategories"),
contentType: 'application/json; charset=utf-8',
error: function (data) {
$("html").html(data.responseText);
},
success: function (data) {
if (useJson) {
$(this).text(JSON.stringify(data));
}
else {
//How do i insert xml data into $(this) as text?
}
}
});
도움 주셔서 감사합니다. :) – burnt1ce