public

jsonp()Method

Description

Starts a JSONP request to a given URL, the provided callback function will be called with the response of the request. There is a timeout of 10s for JSONP calls.

Parameters

Type Name Description
String uri URL of the request, the name of the global jsonp callback function will be added to the URL before issuing the call
Function callback callback function of the JSONP request, in error case will get called with {error: "$CAUSE"}
Number [timeoutInMs = 15000] Number of ms until a timeout occurs, error object {error:"timeout"}

Return Value

Type: Object

request object, containing passed arguments ("uri", "timeout") as its properties and cancel method

Example

 nokia.mh5.require("nokia.mh5.jsonp");

 var request = nokia.mh5.jsonp("http://mydomain.com/doit?jsonp", function(response) {
          console.log("Server responded with:" + response;
      }
 );