I want to dynamically make different YouTube JSON API requests and then use a function to sort the data I want.
Currently following the examples on the YouTube data JSON API site here.
Here is my current code which is getting me the id's nicely.
My question is currently it's using a script tag and the callback URL query to use my function. Is there a different way that I can implement in JavaScript only and keep doing requests that call my getid function?
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
</head>
<body>
<script type="text/javascript">
function getid(data) {
var i=0;
for(items in data.data){
i++
console.log(data.data.items[i].id)
}
}
</script><script type="text/javascript" src="https://gdata.youtube.com/feeds/api/videos?q=surfing&v=2&alt=jsonc&callback=getid"></script>
</body>
</html>