Append data from xml to select
<?xml version="1.0" encoding="iso-8859-1"?>
<dropdown>
<country>India</country>
<country>USA</country>
<country>UK</country>
</dropdown>
<select id="country">
<option>Select Country</option>
</select>
$(document).ready(function(){
$.ajax({
type: "GET",
url: "country.xml",
dataType: "xml",
success: function(xml) {
var select = $('#country');
$(xml).find('dropdown').each(function(){
$(this).find('country').each(function(){
var value = $(this).text();
select.append("<option value='"+ value +"'>"+value+"</option>");
});
});
select.children(":first").text("Select Country").attr("selected",true);
}
});
});