I am currently developing a YT mp3 downloader using the API provided by youtubeinmp3. I have been successful in obtaining the download link in JSON format.
https://i.stack.imgur.com/3mxF2.png
To assign the value of "link" from the JSON to a JavaScript variable ytdlink, I wrote the following code snippet:
function getyt()
{
var a = document.getElementById("mquery").value;
$.get(
"http://www.youtubeinmp3.com/fetch/?format=JSON",
{
video:a
},function(data) {
console.log(data);
var ytdlink = data.link;
});
}
However, I encountered an issue where the value of ytdlink is being set to "function link() { [native code] }". What could be causing this problem and how can I properly assign the link to a JS variable?