I'm trying to pull in view counts for three different youTube videos. I've looked all over, and I can't seem to find what I'm doing wrong.
I followed this question: Get Youtube information via JSON for single video (not feed) in Javascript
And using the script from there, I was able to get the viewCount for the video popping up in an alert, but I still am not exactly sure how to create a success handler that sends the viewCount information into a paragraph.
$(document).ready(function() {
var video_id='VA770wpLX-Q';
$.getJSON('http://gdata.youtube.com/feeds/api/videos/'+video_id+'?v=2&alt=jsonc',function(data,status,xhr){
alert(data.data.viewCount);
});
});
Here's a fiddle of what I have so far: http://jsfiddle.net/wqwxg/199/