0
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 array index?
In PHP, we use the function in_array()
var options = data.options;
var checkeds = data.checkeds;
$.each(options, function(i, item){
$('#ajax_locals').append($('<option>', {
value: i,
text : item,
}));
});