I'm pulling a list of countries from an endpoint. I think that I am constructing the object correctly but I am not getting any results in the search form, however with inline declaration of content[] it works fine.
The API JSON response looks like this:
{country: "Albania", code: "AL"}
{country: "Algeria", code: "DZ"}
{country: "Andorra", code: "AD"}
{country: "Angola", code: "AO"}
var content = [];
$.getJSON('/getCountries', function(data){
$.each(data, function(key, value){
$.each(value, function(key, value){
if (key == 'country') {
content.push({ title: value})
}
})
})
})
$('.ui.search')
.search({
source: content
})
Any ideas?
