jquery.freebase.js

Tags: Posted: May 18, 2009

I've been working on a little widget that pulls data from Freebase (Can't say more than that yet) and needed a nice neat way to query.

In case it could come in handy here's a tiny jQuery plugin for querying Freebase over JSONP.

Code:
jQuery.freebase = function(query, callback, write, sandbox) {
	var host = sandbox ? "api.sandbox.freebase.com" : "api.freebase.com";
	var base = write ? "/api/service/mqlwrite" : "/api/service/mqlread";
	
	var url = "http://" + host + base + '?query={"query":' + jQuery.toJSON(query) + '}&callback=?';
	
	jQuery.getJSON(url, callback );
};

Obviously mqlwrites do not work, I'm going to proxy these.

Code is released as public domain.

User Comments

Alex Says: May 18, 2009

Oh, forgot to mention, this code relies on jquery.json.js.

fqoVtxcaPRKiXgCC Says: Jan 6, 2010

mOReik <a href="http://swcrlllfevsn.com/">swcrlllfevsn</a>, [url=http://irxgcotdytir.com/]irxgcotdytir[/url], [link=http://lydmrpyhpwfj.com/]lydmrpyhpwfj[/link], http://xykhmzcchfxr.com/

WWFLKJeaWreqoFpB Says: Mar 4, 2010

xlpCUU <a href=\"http://opbuxqhokjty.com/\">opbuxqhokjty</a>, [url=http://rplucvixwvpr.com/]rplucvixwvpr[/url], [link=http://dyeoppdnneuu.com/]dyeoppdnneuu[/link], http://yaesfsrwaohr.com/

MWwXktsQ Says: Mar 6, 2010

<a href=\"http://www.arkcalledearth.org/\">buy cialis</a> [url=\"http://www.arkcalledearth.org/\"]buy cialis[/url] http://www.arkcalledearth.org/ buy cialis iixbnu