Skip to content

Instantly share code, notes, and snippets.

@veryeasily
Created May 24, 2013 01:21
Show Gist options
  • Save veryeasily/5640712 to your computer and use it in GitHub Desktop.
Save veryeasily/5640712 to your computer and use it in GitHub Desktop.
Here is this San Francisco topic search with additional logging to show that the whole object with tons of stuff is returned. Make sure to do CTRL-J to open up the console to see the log (of course)
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
</head>
<body>
<script>
var topic_id = '/en/san_francisco';
var service_url = 'https://www.googleapis.com/freebase/v1/topic';
var params = {};
$.getJSON(service_url + topic_id + '?callback=?', params, function(topic) {
console.log(topic);
console.log(topic.property['/common/topic/topic_equivalent_webpage']);
$('<div>',{text:topic.property['/type/object/name'].values[0].text}).appendTo(document.body);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment