2
我有此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"}
對此我從這個Ajax調用
$.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);
});
},
越來越爲什麼我的建議還是空