0
我有一個xml對象,它已通過ajax調用返回,該調用包含1條記錄,33列(只有1條記錄或非條記錄),並且外觀這樣用jquery從xml表中解析記錄的列和數據
xml "<Table>
<Supplier>false</Supplier>
<Address>true</Address>
<ProductInformation>true</ProductInformation>
<ProductDetail>true</ProductDetail>
<BusinessRef>true</BusinessRef>
<RequiredLiveDate>true</RequiredLiveDate>
<ActualLiveDateCheck>true</ActualLiveDateCheck>
<ABEndCheck>true</ABEndCheck>
<FloorRoomRackSpace>true</FloorRoomRackSpace>
<PremisesNameNum>true</PremisesNameNum>
<PremisesExists>true</PremisesExists>
<IsSiteSecure>true</IsSiteSecure>
<CheckTechPres>true</CheckTechPres>
<CheckSepAndResil>true</CheckSepAndResil>
<SuppConfSepAndRes>true</SuppConfSepAndRes>
<DelDateContingency>true</DelDateContingency>
<AwareOfTimeIssues>true</AwareOfTimeIssues>
<VisitorsNames>true</VisitorsNames>
<VisitorsTelNum>true</VisitorsTelNum>
<VisitorsCompanyName>true</VisitorsCompanyName>
<VisitorsNationality>true</VisitorsNationality>
<VisitorsClearanceLvl>true</VisitorsClearanceLvl>
<VisitorsCarReg>true</VisitorsCarReg>
<SiteVisitSponserNme>true</SiteVisitSponserNme>
<SiteVisitArrvalDate>true</SiteVisitArrvalDate>
<SiteVisitTimeSart>true</SiteVisitTimeSart>
<SiteVisitTimeEnd>true</SiteVisitTimeEnd>
<WhichAreaToBeVisited>true</WhichAreaToBeVisited>
<WhoIsToMeetVisitor>true</WhoIsToMeetVisitor>
<FSSiteName>NA</FSSiteName>
<WorkType>Cabling</WorkType>
<VisitorContact>Alan Legg</VisitorContact>
<SiteLocation>Tech Hall 1</SiteLocation>
</Table>" String
,這裏是在拉數據的代碼:
function getExistingCheckList() {
var PWNum = 'PW11896';
var testddl = $("#testddl");
$.ajax({
type: "POST",
url: "Circuits_OrderManagementTracker.aspx/getAnyChecklistRecords",
data: "{'PWNum': '" + PWNum + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
var xmlDoc = $.parseXML(response.d);
var xml = $(xmlDoc);
var CheckListsReturned = xml.find("Table");
$.each(CheckListsReturned, function (index, CheckListsReturned) {
ColumnName = $(this).find("title").????()
columnsData = $(this).find("title").????()
testddl.append('<option>' + ColumnName + '</option>');
testddl2.append('<option>' + columnsData + '</option>');
});
},
failure: function (msg) {
alert(msg);
}
});
}
我希望通過XML拉出列名和列值遍歷所有33列和填充2下拉,但即時通訊與語法掙扎,你能幫我嗎?
如果是XML,你爲什麼有'數據類型: 「JSON」'在theAJAX打電話? – Barmar 2013-03-26 14:55:07
請編輯問題並顯示實際的XML標籤。 – Barmar 2013-03-26 14:56:59
嗨Barmar我累了添加標籤,但頁面處理它,它似乎只顯示處理的XML。虐待增加它,但我不確定如何讓它顯示爲它的原始狀態。 – MoiD101 2013-03-26 15:22:53