All samples are using Ink.requireModules, please read how to use it at Ink.requireModules section

Ink.Net.JsonP class

Executes a JSONP request

Method name Description
new JsonP(uri, options) Constructor
.abort() Abort the request, avoiding onSuccess or onFailure being called.

new Ink.Net.JsonP(uri, options)


  • uri

    Request URL
  • options

    Request options
  • options.onSuccess

    Success callback. Called with the JSONP response.
  • options.onFailure

    Failure callback. Called when there is a timeout.
  • options.failureObj

    Object to be passed as argument to failure callback
  • options.timeout

    Timeout for the request, in seconds. defaults to 10.
  • options.params

    Object with URL parameters.
  • options.callbackParam

    URL parameter which gets the name of the JSONP function to call. defaults to 'jsoncallback'.
  • options.randVar

    (Advanced, not recommended unless you know what you're doing) A string to append to the callback name. By default, generate a random number. Use an empty string if you already passed the correct name in the internalCallback option.
  • options.internalCallback

    (Advanced) Name of the callback function stored in the Ink.Net.JsonP object (before it's prefixed).

Make a request to SAPO Photos and print the images


<div id="container"></div>
Ink.requireModules(['Ink.Net.JsonP_1'], function(JsonP) {

    var uri = '';
    new JsonP(uri, {
        params: {limit: '3'}, // the query string parameters can be defined here 
        onSuccess: function(data) {
            var aItems =;
            var container = Ink.i('container');
            var curImg;
            for(var i=0, total=aItems.length; i < total; i++) {
                curImg = new Image();
                curImg.src = aItems[i]['media:thumbnail'][0].url;
        onFailure: function() {
            Ink.warn('JsonP request failed');

.abort() method

Abort the request, avoiding onSuccess or onFailure being called.