我遇到这种情况:
$.getJSON(url, args,
function(data) {
info("");
$("#results").empty();
if (! ('songs' in data.response)) {
info("Can't find anything");
} else {
$("#all_results").show();
var tbody = $("#all_results_body");
tbody.empty();
$.each(data.response.songs, function(i, song) {
var row = $("<tr>");
var artist = song.artist_name;
//var artist = make_link(song.artist_name,
//'http://static.echonest.com/echotron/?id=' + song.artist_id, 'other');
var tid = song.tracks[0].foreign_id.replace('-WW', '');
var tid = tid.replace('-US', '');
var title = make_link(song.title, tid);
/*var nacousticness = Math.round(song.audio_summary.acousticness * 10000) / 10000;*/
row.append( $("<td style='width:5%;'>").text(i + 1) );
row.append( $("<td style='width:40%;'>").append(artist));
row.append( $("<td style='width:55%;'>").append(title) );
/*row.append( $("<td>").text(nacousticness));*/
tbody.append(row);
console.log(song.artist_id, song.id, song.audio_summary.acousticness,
song.artist_name, song.title);
document.write(tid + " ");
});
}
},
document.write给出结果等: Spotify的:跟踪:4ISIMO6EMPq9auijVz0MoB Spotify的:轨道:5yJo1wqMVw6XWZaGRl9kQC Spotify的:轨道:32uqV4nV8P0CiRDaVrEbcY Spotify的:轨道:3YFw3zTOzjCs7PL6ebNhho Spotify的:轨道:1kQEgJ8C2wSrGBLa5YCKpe Spotify的:轨道:3wFqyQrlY7NfEriHCGdbyy Spotify的:轨道:0AcyyjJh01tIrwBn538Bk1 Spotify的:轨道:6dQJI4hFolhMnZhSHxkuGc Spotify的:轨道:4r13PlX7hKjNxdyq5ukR5A Spotify的:轨道:1Oenqmtbzt331Pgv0ODfS2 Spotify的:跟踪:7nFlzPTW9WGNJ2y9t3Tfvw Spotify的:轨道:3zIauDOxaYXR404SPlX9bv Spotify的:轨道:1uAwfDonpvw6Z4OsITZzzA Spotify的:轨道:3ssX20QT5c3nA9wk78V1LQ Spotify的:轨道:7vB7thPuSBLqG1LnTq8Yf7 Spotify的:轨道:3dmnVNKCxtohL1FJsM7xWr Spotify的:轨道:4oQgsytVrNH5dOdiLRVKCx Spotify的:轨道:6VD2YPeb1P3BCP5q0lZHrs Spotify的:轨道:3NOUuHRQHMcfqht2OTgQqP Spotify的:轨道:3ia3dJETSOllPsv3LJkE35
我想将这些值保存到按钮或textarea中 感谢