jQuery: How can I output content of an XML document to a node?
<p>How can i output the content of an XML document to $(this) in the success event handler?</p>

<pre><code>var useJson = false;

var acceptHeader;
if (useJson) {
    acceptHeader = "application/json";
} else {
    acceptHeader = "text/xml"
}


$.ajax({
    url: '&lt;%= Url.Action("GetAllCategories") %&gt;',
    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?
        }
    }
});
</code></pre>
