J
J
jackie chan2015-11-15 16:16:40
JavaScript
jackie chan, 2015-11-15 16:16:40

How to pass values ​​from one script to another?

There is a list of about 1000 audios, each has its own id, how can I pass this id to the field of the second script

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 +'<span class="label">'+ song.aid +' - '+ song.owner_id+'</span></a><a href="javascript:addaudio();">+</a></li>'
        }))
      }
    });
};

Second script
function addaudio(){
VK.Api.call('audio.add', { audio_id:' Как сюда воткнуть id песни? ', owner_id:'+ сюда id загр.пользователя+' }, function (data) {
  if (data.response) {
    console.log(data.response);
  		}
  });
};

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sanex3339, 2015-11-15
@sanex3339

I have already given you a partial answer to your question (which fully answers the current question)
How to merge two JavaScript codes?
PS: with your attitude to every sneeze to create on the issue, you will not go far.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question