It is necessary on an output from echo json_encode($array); get this json format:
var currencies = [ { id: '1', name: 'Paris' }, { id: '2', name: 'London' } ]; The array $ array is the result from the query to the database for a sample of 2 id and name fields.