YUILibrary - Open source JavaScript and CSS for building richly interactive software.
Fork YUI on GitHub
  • Home
  • Gallery
  • Forums
  • YUI 2
  • YUI 3
  • YUI Labs
  • YUI Compressor
  • More
  • Gallery Forums
  • Gallery Stats
  • Gallery Calendar
  • Register
  • Login

Modules

  • Home
  • Featured
  • Popular
  • New
  • All

Documentation

  • FAQ
  • Developer FAQ
  • Developer Guide
  • Module Setup

Tag Cloud

form port ericf skinnable widget slideshow jafl jsonp lsmith event nzakas rgrove node davglass apipkin foxxtrot overlay tivac plugin yui2 caridy jacobfogg ajax animation adam io

Context Navigation

    YUI Library is not responsible for bugs or support with this module. It is available as a free service. For support please contact the module owner with the provided links.

    JSONP (gallery-jsonp) on cdn

    Last Updated: 02/8/10
    + 0 -

    Luke Smith

    YUI Developer

    See 6 more by this user.

    Featured Item

    Created: 10/24/09
    Last CDN Push: 08/11/10
    Build Tag: gallery-2010.08.11-20-39
    Project: YUI 3
    License: YUI BSD
    YUI Version: 3.0.0
    Free for use.

    Provides a JSONPRequest class for repeated JSONP calls, and a convenience method Y.jsonp(url, callback) to instantiate and send a JSONP request.

    The callback for the response can be named in the url explicitly or provided in the configuration (second parameter to the constructor).

    By default, the query parameter string &quot;callback=???&quot; will be searched for in the url (??? can be anything). If it's not found, it will be added on. If the JSONP service uses a different parameter name or url format, you can override this behavior with the <code>format</code> property in the callback config.

    The second parameter can be a callback function that accepts the JSON payload as its argument, or a configuration object supporting the keys:

    * on - map of callback subscribers
    * success - function handler for successful transmission
    * failure - function handler for failed transmission
    * timeout - function handler for transactions that timeout
    * format - override function for inserting the proxy name in the url
    * timeout - the number of milliseconds to wait before giving up
    * context - becomes <code>this</code> in the callbacks
    * args - array of subsequent parameters to pass to the callbacks

    • Tags:
    • jsonp
    • lsmith
    • Download
    • Docs
    • Homepage
    • Bugs
    • Source
    • Example
    • Forum
    • History

    Code Sample

    <script src="http://yui.yahooapis.com/3.1.0/build/yui/yui-min.js"></script>
    YUI({
        //Last Gallery Build of this module
        gallery: 'gallery-2010.08.11-20-39'
    }).use('gallery-jsonp', function(Y) {
     
        var url = "http://query.yahooapis.com/v1/public/yql?" +
                      "q=select%20*%20from%20upcoming.events%20" +
                      "where%20woeid%20in%20" + 
                      "(select%20woeid%20from%20geo.places%20" +
                      "where%20text%3D%22North%20Beach%22)" +
                      "&format=json&diagnostics=false";
     
        var upcoming = Y.one('#upcoming');
     
        Y.jsonp(url, function (data) {
            Y.each(data.query.results.event, function (o) {
                upcoming.append("<h3>" + o.name + "</h3><p>" + o.description + "</p>");
            });
        });
     
    });

    Forum Posts

    Subject Author Date
    Calling jsonp more than once on a page fails jrussbowman 01/9/10
    Re: Calling jsonp more than once on a page fails Luke Smith 02/8/10
    JSONP and Yahoo! Pipes Itye Richter 04/28/10
    Re: JSONP and Yahoo! Pipes Itye Richter 04/28/10
    YUI Projects
    • All YUI Downloads
    • YUI 2
    • YUI 3
    • YUI Doc
    • YUI Compressor
    • YUILibrary.com
    • YUI Build Tool
    • YUI PHP Loader
    YUI Labs
    • All YUI Labs Projects
    • Yeti
    Pages & Links
    • All YUI Downloads
    • Git FAQ
    • Graded Browser Support
    • Contribute to YUI
    • Forum Stats
    • Gallery Stats
    • YUI Calendar
    Contribute
    • Submit a Bug
    • Request a Feature
    • Write Code
    • Meet the Team
    Follow YUI
    • on GitHub
    • on Twitter
    • on FriendFeed
    • on Facebook
    • on IRC
    • YUI Blog
    • YUI Theater
    • YUI Forums

    © 2010 YUI Library - Site Credits