I have this json
{"suggestions":["M.I.A.","M.","Mindless Self Indulgence","The Cure","Telefon Tel Aviv","M","J. Ralph","Jason Mraz","Carbon Based Lifeforms","Cycle of Pain","Chantal Kreviazuk","-M-","ayumi hamasaki","R.E.M.","Donny McCaslin","Penfold","HEALTH","R. Kelly","DJ Khaled","Eminem","Spose","T.I.","The Lonely Island","H.I.M. (His Infernal Majesty)","Dropkick Murphys","Taylor Swift"],"query":"m"}
which i am getting from this ajax call
$.getJSON('<%= ajax_path("artistName") %>', req, function(data) {
//create array for response objects
var suggestions = [];
console.log(data);
//process response
$.each(data, function(i, val){
suggestions.push(val.name);
});
console.log(suggestions);
//pass array to callback
add(suggestions);
});
},
why is my suggestions still null