[Grok-dev] grok & JSONP
Leonardo Rochael Almeida
leorochael at gmail.com
Wed Sep 10 19:28:01 EDT 2008
Hi,
A few years ago, Bob Ippolito, the simplejson maintainer proposed[1] a
way to allow json calls to be made cross-site despite limitations on
the XmlHttpRequest object to connect only to the same domain the
original page came from.
This has recently been made popular by js libraries[2] and web apps
and APIs like flickr, AIM, etc...
Implementing this in grok seems simple enough, just check for a
request variable, but I'd like to know how we should implement it.
Should we just enable all JSON calls if a 'callback' parameter is
present in the request? Should we use another class, like grok.JSONP?
Should we add a function decorator like
grok.jsonp(callbackname='callback') that decorates the function such
that grok.JSON.__call__ only does the JSONP wrapping in if this
decorator is present (my personal preference)?
I'd be willing to work on this.
[1] http://bob.pythonmac.org/archives/2005/12/05/remote-json-jsonp/
[2] http://docs.jquery.com/Ajax/jQuery.getJSON
More information about the Grok-dev
mailing list