Last active
October 24, 2015 00:58
-
-
Save philmein23/683c0b91a90a3d4f0885 to your computer and use it in GitHub Desktop.
You Tube
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
$("#search-term").submit(function(event) { | |
event.preventDefault(); | |
var searchTerm = $("#query").val(); | |
getRequest(searchTerm); | |
}) | |
function getRequest(searchTerm) { | |
var params = { | |
part: 'snippet', | |
key: 'AIzaSyAJH04pfGBf6N34ileppDhtSd5GMZqecto', | |
q: searchTerm //unsure here | |
}; | |
url = 'https://www.googleapis.com'; | |
$.getJSON(url, params, function(data){ | |
showResults(data.Search); //unsure here | |
}) | |
} | |
function showResults(results) { | |
var html = ""; | |
for (var i = 0; i < results.length; i++) { | |
var myData = results[i]; //need to re-configure for youtube | |
html += "<p>" + myData + "</p>"; //need to configure for youtube | |
console.log(myData); | |
} | |
$("#search-results").html(html); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment