I have an array of ids and I'm returning this array in the ajax response. How to compare this array with the select options and mark the option if it matches the index of the array?
In PHP, we use the in_array ()
var options = data.options;
var checkeds = data.checkeds;
$.each(options, function(i, item){
$('#ajax_locals').append($('<option>', {
value: i,
text : item,
}));
});