jQuery getJSON
Populate a dropdown list from a JSON service using $.getJSON and $.each.
An example of using $.getJSON to fill a dropdown list.
js
$.getJSON("URL", null,
function (data) {
$.each(data.d, function (i, result) {
var optionText = "<option value='" + result.value + "'>"
+ result.text + "</option>";
$('#ddlSelectTagId').append(optionText);
});
}
);
Replace URL with the address of your service. For each item returned, the code builds an option element and appends it to the select with the id ddlSelectTagId.