JSONP Loader

Block Group: Browser API
Icon:JSONP Loader block icon

Retrieves JSONP data from the specified URL. A callback function must be defined at the URL.

For information on using dataflow blocks, see Dataflow.


Input/Output Properties

These properties can take input and give output.

  • invoke (trigger)
  • enabled (boolean)
  • interval (number)
  • autoRun (boolean)
  • timeout (number)
  • url (string)
  • callback (string)

invoke causes the data to be loaded. Only works when enabled is set to TRUE.

enabled specifies whether the loader is active.

  • TRUE: The JSONP data is retrieved as specified by invoke, interval, and autoRun.
  • FALSE: Nothing happens when this block is invoked.

interval specifies how often the loader gets data, in seconds.

autoRun specifies whether the loader gets data automatically. Only works when enabled is set to TRUE.

  • TRUE: The data is loaded every time any property is changed. This includes the first time that the url property is populated.
  • FALSE: The data is loaded only when the invoke property is triggered, or at the specified interval.

timeout specifies how long the loader will attempt to load the string before the request is canceled.

url specifies the location of the JSON string.

callback specifies the name of the callback function used to retrieve the data. This function must be defined at the URL. You might be able to copy the function name from the URL string, or you might need to find it at the URL.


Output Properties

These properties can give output. They cannot take input.

  • loading (boolean)
  • output (string)
  • onComplete (event)
  • error (string)

loading returns whether the block is currently loading data.

output returns the JSON string.

onComplete fires when the JSON string is loaded.

error returns the error message, if any.


Model

This is a basic use of the block.

JSONP Loader dataflow modelThis example uses the URL http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=processJSON&tags=san_francisco&tagmode=any&format=json. The callback defined at the URL is called processJSON. The output is linked to a JSON Parser block to create a table.