Parsing through a table in an xml object that only has one row retrieved from a database
Hi i have one record (it will only ever be 1 record or nothing at all) retrieved from a webservice via a ajax() call. The record has 33 fields, a small extract is below:
xml
"<Table>
<Supplier>false</Supplier>
<Address>true</Address>
<ProductInformation>true</ProductInformation>
<ProductDetail>true</ProductDetail>
<29 other columns... >
</Table>" String
I am unsure how to access the column names and the columns values when i iterate through syntax wise as i am still very new to coding in general.
here is the code:
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("WhatGoesHerePlease").????() ColumnName = $(this).find("WhatGoesHerePlease").????() alert(dbname); testddl.append('<option>' + ColumnName + '</option>');
testddl2.append('<option>' + Columns Value + '</option>'); }); }, failure: function (msg) { alert(msg); } }); }