Skip to content

Instantly share code, notes, and snippets.

Created June 19, 2015 02:50
Show Gist options
  • Save anonymous/6c3131dfcd52f4b6dd7a to your computer and use it in GitHub Desktop.
Save anonymous/6c3131dfcd52f4b6dd7a to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/bunoma
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<iframe width="420" height="315" id="video">
</iframe>
<script id="jsbin-javascript">
var search_term = "brandon";
var api_key = 'AIzaSyDiUEkwoldcB9qgRreOsaiyu2Nlj8U-03c';
var youtube_url = 'https://www.googleapis.com/youtube/v3/search?part=id&q=' +search_term +'&maxResults=1&key=' +api_key;
var video_url = 'http://www.youtube.com/embed/' +"videoID"+'?autoplay=1';
$.ajax({
method: 'GET',
url: youtube_url,
success: onSuccess
});
function onSuccess() {
console.log(data);
// video.src = video_url;
}
</script>
<script id="jsbin-source-javascript" type="text/javascript">var search_term = "brandon";
var api_key = 'AIzaSyDiUEkwoldcB9qgRreOsaiyu2Nlj8U-03c';
var youtube_url = 'https://www.googleapis.com/youtube/v3/search?part=id&q=' +search_term +'&maxResults=1&key=' +api_key;
var video_url = 'http://www.youtube.com/embed/' +"videoID"+'?autoplay=1';
$.ajax({
method: 'GET',
url: youtube_url,
success: onSuccess
});
function onSuccess() {
console.log(data);
// video.src = video_url;
}
</script></body>
</html>
var search_term = "brandon";
var api_key = 'AIzaSyDiUEkwoldcB9qgRreOsaiyu2Nlj8U-03c';
var youtube_url = 'https://www.googleapis.com/youtube/v3/search?part=id&q=' +search_term +'&maxResults=1&key=' +api_key;
var video_url = 'http://www.youtube.com/embed/' +"videoID"+'?autoplay=1';
$.ajax({
method: 'GET',
url: youtube_url,
success: onSuccess
});
function onSuccess() {
console.log(data);
// video.src = video_url;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment