我有一些我返回的XML代码。问题是,如何将其推送到$("#container").html
?
我会做一些事情,比如找到ID并将详细信息(ows_kxoi)推送到容器吗?
$(xData.responseXML).find("z:row, ows_ID=1").push($("#container").html)
返回的XML:
<z:row ows_Title='Safeway - 24-7 Nurseline' ows_ID='1'
ows_kxoi='<div class="ExternalClassE873CA13CAC245429C873C746B5A144E">24-7 Nurseline</div><div class="ExternalClassE873CA13CAC245429C873C746B5A144E"><div>866-670-5681&#160;Option 6</div><br></div>' ows_MetaInfo='1;#'
ows__ModerationStatus='0' ows__Level='1'
ows_UniqueId='1;#{7F7F703A-8EAB-4C54-9DB4-7BE5AF1924C1}'
ows_owshiddenversion='6' ows_FSObjType='1;#0'/>
答案 0 :(得分:0)
这就是我所做的:
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 这将在元素中设置id为'container'的内容。