There are two js codes:
- one prints up to 1000 elements (containing aid and owner_id):
function recommendate(){ VK.Api.call('audio.getRecommendations', {count: '1000'}, function(r) { if(r.response) { $('#playlist').empty().append($.map(r.response, function(song){ return '<li><a href="'+ song.url +'"><b>'+song.artist+'</b> - '+ song.title +'</a><div class="add-song" data-aid="'+ song.aid +'" data-aid-id="'+ song.owner_id +'"></div><a href="javascript:addaudio();">+</a></li>' })) } }); }; - the second you need to pass the parameters and execute the code
function addaudio() { VK.Api.call('audio.add', { audio_id: Сюда song.aid , owner_id: Сюда song.owner_id }, function (data) { if (data.response) { console.log(data.response); } }); }; Question: how can I, when I click on +, transfer all this to js and execute the query? Actually you need to take the song.aid and song.owner_id.