"We make it easier to work with Yahoo’s services than Yahoo does." That is what Alex believes as he announces that Dojo supports Yahoo! Pipes, which adds to the forward-thinking JSON-P style endpoints.
It’s cool and interesting to be able to call out to Pipes from your server-side web-app, but what the mashup-mad word REALLY needs is to be able to do the same thing from a browser. Despite not really being in the docs anywhere, Yahoo’s Kent Brewster points out that Pipes supports a JSON-P callback argument. Awesome!
The structure of Pipes URLs are different than every other Yahoo service (much like flickr. ugg.), so there’s no Dojo RPC for it yet, but you can easily query a pipe using dojo.io.bind and the ScriptSrcIO transport:
JAVASCRIPT:
// get news results for Cometd
dojo.require("dojo.io.ScriptSrcIO"); // the x-domain magic
dojo.require("dojo.debug.console"); // firebug integration
dojo.io.bind({
// grab this URL from the pipe you're interested in
url: "http://pipes.yahoo.com/pipes/fELaGmGz2xGtBTC3qe5lkA/run",
mimetype: "text/json",
transport: "ScriptSrcTransport",
jsonParamName: "callback”, // aha!
content: {
“render”: “json”,
“textinput1″: “cometd”
},
load: function(type, data, evt){
// log the response out to the Firebug console
dojo.require(”dojo.json”);
dojo.debug(dojo.json.serialize(arguments));
}
});
No comments:
Post a Comment