简体   繁体   English

返回的XML,但如何在容器中显示呢?

[英]Returned XML but how do I display it in container?

I have some XML code I returned. 我有一些返回的XML代码。 The question is, how do I push it to $("#container").html ? 问题是,如何将其推送到$("#container").html

Would I do something like find the ID and push the details (ows_kxoi) to the container? 我会做类似查找ID并将细节(ows_kxoi)推送到容器的操作吗?

$(xData.responseXML).find("z:row, ows_ID=1").push($("#container").html)

The returned XML: 返回的XML:

<z:row ows_Title='Safeway - 24-7 Nurseline' ows_ID='1'
  ows_kxoi='&lt;div class=&quot;ExternalClassE873CA13CAC245429C873C746B5A144E&quot;&gt;24-7 Nurseline&lt;/div&gt;&lt;div class=&quot;ExternalClassE873CA13CAC245429C873C746B5A144E&quot;&gt;&lt;div&gt;866-670-5681&amp;#160;Option 6​&lt;/div&gt;&lt;br&gt;&lt;/div&gt;' ows_MetaInfo='1;#'
  ows__ModerationStatus='0' ows__Level='1'
  ows_UniqueId='1;#{7F7F703A-8EAB-4C54-9DB4-7BE5AF1924C1}'
  ows_owshiddenversion='6' ows_FSObjType='1;#0'/>

This is what I did: 这是我所做的:

function getData() {
    $.ajax({
        url: dataSet.SiteUrl + "/_vti_bin/lists.asmx",
        type: "POST",
        dataType: "html",
        data: soapEnv,
        success: function(result){
            processResult();
            var data = $.parseHTML(result);
            $('#container').html($(data).attr('ows_kxoi'));
        },
        complete: processResult,
        contentType: "text/xml; charset=\"utf-8\""
    });
}

Here is the JSFiddle demo This will set the content in the element with id 'container'. 这是JSFiddle演示。这将在ID为'container'的元素中设置内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM