Skip to content Skip to sidebar Skip to footer

Populate Dropdown Using Json

I need to know how to populate a dropdown using the JSON object.. Im using php to send json to the client.. client catches the json data using ajax. i use below code to check wha

Solution 1:

Your HTML

<select id="myselect">
</select>

The javascript(Using jQuery)

var json={} // Populate this json object
$.each(json, function(key, value){
    $('#myselect').append("<option value='"+key+"'>"+value+"</option>");
});

Post a Comment for "Populate Dropdown Using Json"