Good evening. Help me please. It is necessary to parse the response from the VKontakte API on js. Here is my function:

$(document).ready(function(){ $.ajax({ type: "GET", url: "https://api.vk.com/method/audio.get?user_id=XXX&shuffle=1&count=1&access_token=XXX", dataType: "jsonp", success: function(response){ alert(response.response['url']); } }); }; 

I get this answer:

 {"response":[{"aid":456239060,"owner_id":XXX,"artist":"The White Buffalo & The Forest Rangers ","title":"Come Join the Murder","duration":450,"url":"https:\/\/cs7-3v4.vk-cdn.net\/p21\/2d8df3cdd8131f.mp3?extra=p7gw8f1MeLhsDampJ_ZEaAB-JOOo6BtKbsR6lX-EQAfEj482z9dotFcRD_YgRnwIKBG62F9clyqAmmGk6bRXmuR9ay3KOgnXt3BK-375NgHBi0iU7hQxkbiD3aRlzU2KB6_qnKJ-uLAZL74","genre":1001}]} 

And I just can not get the artist, title and url. I know the implementation in php, but I need it in javascript. Tell me please.

  • response.response[0]['artist'] , response.response[0]['title'] , response.response[0]['url'] ......... array same - Alexey Shimansky
  • @ Alexey Shimansky thanks! Exactly, works - dkova

0