JQuery and .getJSON for YouTube API

I'm trying to figure out how to determine the number of results returned from a API call to YouTube.  I want to create a search function within a YouTube channel, but I need to know how many results to loop through.

Here's my code.
response.length is undefined - but I was just trying a bunch of things I found online.

Thanks for your help!!!

$('#vform1 #vsubmit').click(function(){
	

		var url = 'http://gdata.youtube.com/feeds/api/users/nba/uploads/-/sports/playoffs?v=2&alt=json';
		var title;
		var description;
		
		$.getJSON(url,function(response) {
				alert("Data feed title: " + response.data.items[2].id);
				alert("Length: " + response.length);
				
            });
        return false;
							
		
		});

Open in new window

LVL 1
slightlyoffAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

leakim971PluritechnicianCommented:
$('#vform1 #vsubmit').click(function(){
	

		var url = 'http://gdata.youtube.com/feeds/api/users/nba/uploads/-/sports/playoffs?v=2&alt=json&callback=?';
		var title;
		var description;
		
		$.getJSON(url,function(response) {
				alert("Length: " + a.feed.entry.length);
				
            });
        return false;
							
		
		});

Open in new window

0
leakim971PluritechnicianCommented:
Test page : http://jsfiddle.net/snQEg/

        $('#vsubmit').click(function(){
            var url = 'http://gdata.youtube.com/feeds/api/users/nba/uploads/-/sports/playoffs?v=2&alt=json&callback=?';
            $.getJSON(url,function(response) {
                alert("Length: " + response.feed.entry.length);
                var title;
                for(var i=0;i<response.feed.entry.length;i++) {
                    title = response.feed.entry[i].title.$t;
                    $("#titles").append("<li>"+title+"</li>")
                }
            });
            return false;
        });

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
slightlyoffAuthor Commented:
Thanks - I appreciate your quick reply!
That was what I needed :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.