I\'m tyring to use AJAX to populate a dropdown box based on the selection of another dropdown. I followed a tutorial using jQuery located here - http://remysharp.com/2007/01
If you could slightly change your response to return value and text keys in JSON:
[{
value: 10,
text: 'Remy'
}, {
value: 11,
text: 'Arif'
}, {
value: 12,
text: 'JC'
}]
you could use JQuery view engine and just load the array into a dropdown:
$.getJSON("contactList", {
id: $(this).val(),
ajax: 'true'
},
function(j) {
$("select#QuoteContactId").view(response);
})
See details here: https://jocapc.github.io/jquery-view-engine/docs/ajax-dropdown