locked
load xml data to select option RRS feed

  • Question

  • User1136423486 posted

    <Server>

    <Country>India</Country>

    <Environment>Dev</Environment>

    </Server>

    How can i display this in dropdown list (select tag) 

    Wednesday, June 10, 2020 5:54 AM

Answers

  • User1136423486 posted

    $(function () {
    var XML_PATH = "../xmlfile.xml";

    $.ajax({
    type: "GET",
    url: XML_PATH,
    dataType: "xml",
    success: function (xml) {

    $(xml).find('Country').each(function () {
    var country = $(this).text();
    $('#list').append("<option value='" + country + "'>" + country + "</option>");
    });
    }
    });
    });

    I found answer.....

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, June 10, 2020 7:17 AM