Skip to content

Instantly share code, notes, and snippets.

@felquis
Forked from anonymous/youtube.php
Created September 21, 2011 19:43
Show Gist options
  • Save felquis/1233083 to your computer and use it in GitHub Desktop.
Save felquis/1233083 to your computer and use it in GitHub Desktop.
Youtube
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript">
//inicio o jquery
$(document).ready(function(){
$.ajax({
url: "http://gdata.youtube.com/feeds/base/users/videosimprovaveis/uploads?orderby=updated&v=2&alt=json",
dataType: "jsonp",
success: function(data){
console.log('SUCESSO');
console.log(data);
var html = '';
var i = 0;
while(i < data.results.length)
{
var titulo = data.results[i].title;
var user = data.results[i].author;
html ="<p>"+titulo+"</p>";
html +="<p>"+user+"</p>";
i++;
}
$('#youtube').html(html);
},
error : function(a , b){
console.log('ERRO');
console.log(a, b);
}
});
});
</script>
<div id="youtube">
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment