/* Loading JSON objects using JSONP */
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.1.1.min.js"></script>
<select id="deps" name="deps"></select>
<script>
$.ajax({
type: 'GET',
url: 'http://a.b.c/api/func_name',
async: false,
contentType: "application/json",
dataType: 'jsonp',
success: function(data) {
$.each(data, function (i, itemvalue) {
var o = new Option(itemvalue.name, itemvalue.id);
$(o).html(itemvalue.name);
$("#ctrl").append(o);
});
},
error: function(e) {
console.log(e.message);
}
});
</script>
留言列表