Example of fetching data from FB...
$(document).ready(function(){
var name;
var link;
var gender;
var id;
$.getJSON( "http://graph.facebook.com/4/", function( json ) {
name = json.name;
link = json.link;
gender = json.gender;
id = json.id;
var person = {name:name,link:link,gender:gender,id:id};
console.log(person);
// This gives me exactly what I need but only in console view.
$('html').text(person);
// This just writes [object Object] inside my window
return person;
});
});
I appreciate your help, I know this are the basics but right now my brain doesn't work as it should :\
$('html').text(JSON.stringify(person));
, but I doubt that's what you want. You could do$('html').text('Name: '+name/*...*/)
. – blex Mar 4 '15 at 22:44