Skip to content
This repository has been archived by the owner on Jan 24, 2019. It is now read-only.

Latest commit

 

History

History
76 lines (56 loc) · 1.31 KB

2012-12-12-getJSONP.md

File metadata and controls

76 lines (56 loc) · 1.31 KB
title
getJSONP

getJSONP

Purpose

Request remote JSONP data

Options

  • scriptSource - a string of the name of the script to be loaded
    • callback=jsonp ( or similar ) - params are required to use with any JSONP service
  • callback - a function to be run when the script has been loaded

Examples

{% highlight js linenos %} Popcorn.xhr({

  url: "jsonp.json?callback=jsonp",
  dataType: "jsonp",
  success: function( data ) {
    /*
      `data` will be the parsed json object

    */
  }
});

{% endhighlight %}


{% highlight js linenos %} Popcorn.getJSONP(

  "jsonp.json?callback=jsonp",
  function( data ) {
    /*
      `data` will be the parsed json object

    */
  }
);

{% endhighlight %}


{% highlight js linenos %} Popcorn.xhr({

  url: "http://domain.com/service/?callback=jsonp",
  dataType: "jsonp",
  success: function( data ) {
    /*
      `data` will be the parsed json object

    */
  }
});

{% endhighlight %}


{% highlight js linenos %} Popcorn.getJSONP(

  "http://domain.com/service/?callback=jsonp",
  function( data ) {
    /*
      `data` will be the parsed json object

    */
  }
);

{% endhighlight %}