Skip to content

Commit

Permalink
"Added sample: javascript/search.js"
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyDiamondstein committed Dec 9, 2013
1 parent e9ae998 commit 7b1e273
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions javascript/search.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// After the API loads, call a function to enable the search box.
function handleAPILoaded() {
$('#search-button').attr('disabled', false);
}

// Search for a specified string.
function search() {
var q = $('#query').val();
var request = gapi.client.youtube.search.list({
q: q,
part: 'snippet'
});

request.execute(function(response) {
var str = JSON.stringify(response.result);
$('#search-container').html('<pre>' + str + '</pre>');
});
}

0 comments on commit 7b1e273

Please sign in to comment.