troubleshooting Question

jquery, loop xml

Avatar of ITsolutionWizard
ITsolutionWizardFlag for United States of America asked on
2 Comments1 Solution135 ViewsLast Modified:
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("GeneralInformation").find('State').text();
                var bondName = $event.find("GeneralInformation").find('Name').text();

Is it possible to do something like /node then run for loop to get the children nodes?


function fnGetBondNameList() {
    var thisTable = $("#table1").dataTable();
    var selecthtml = '';    
        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("GeneralInformation").find('State').text();
                var bondName = $event.find("GeneralInformation").find('Name').text();
                var line = '<button onclick="funDisplayBondInformation(' + "'" + bondState + "'" + "," + "'" + bondName + "'" + ')" id="btnSubmitSelectedBond" name="btnSubmitSelectedBond" class="btn btn-primary btn-xs">Select</button>';

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros