below codings are working fine but I want to loop the xml child nodes instead of the hard codes.
e.g. i have two items below
var bondState = $event.find("GeneralInform
ation").fi
nd('State'
).text();
var bondName = $event.find("GeneralInform
ation").fi
nd('Name')
.text();
Is it possible to do something like /node then run for loop to get the children nodes?
Thanks
function fnGetBondNameList() {
var thisTable = $("#table1").dataTable();
var selecthtml = '';
$.ajax({
url: "
http://localhost:5489/BondList.xml",
// data: data,
//type: "POST",
success: function (response) {
var $events = $(response).find("Bond");
$events.each(function (index, event) {
var $event = $(event),
addData = [];
var bondState = $event.find("GeneralInform
ation").fi
nd('State'
).text();
var bondName = $event.find("GeneralInform
ation").fi
nd('Name')
.text();
addData.push(bondName);
addData.push(bondState);
var line = '<button onclick="funDisplayBondInf
ormation('
+ "'" + bondState + "'" + "," + "'" + bondName + "'" + ')" id="btnSubmitSelectedBond"
name="btnSubmitSelectedBon
d" class="btn btn-primary btn-xs">Select</button>';
addData.push(line);
thisTable.fnAddData(addDat
a);
});
}
});
}
Our community of experts have been thoroughly vetted for their expertise and industry experience.