Clear Up
SharpKit Reference

JsonP Class


Base Types



Name Description


Name Description
abort(object) Abort a request. If the request parameter is not specified all open requests will be aborted. @param {Object/String} request (Optional) The request to abort
cleanupErrorHandling(object) Cleans up anu script handling errors @private @param {Object} request The request
createScript(JsString, object) Create the script tag @private @param {String} url The url of the request @param {Object} params Any extra params to be sent
handleAbort(object) Handles any aborts when loading the script @private @param {Object} request The request
handleError(object) Handles any script errors when loading the script @private @param {Object} request The request
handleResponse(object, object) Handle a successful response @private @param {Object} result The result from the request @param {Object} request The request
handleTimeout(object) Handle any script timeouts @private @param {Object} request The request
request(object) Makes a JSONP request. @param {Object} options An object which may contain the following properties. Note that options will take priority over any defaults that are specified in the class.
  • url : String
    The URL to request.
  • params : Object (Optional)
    An object containing a series of key value pairs that will be sent along with the request.
  • timeout : Number (Optional)
    See {@link #timeout}
  • callbackKey : String (Optional)
    See {@link #callbackKey}
  • callbackName : String (Optional)
    The function name to use for this request. By default this name will be auto-generated:,, etc. Setting this option to "my_name" will force the function name to be Use this if you want deterministic behavior, but be careful - the callbackName should be different in each JsonP request that you make.
  • disableCaching : Boolean (Optional)
    See {@link #disableCaching}
  • disableCachingParam : String (Optional)
    See {@link #disableCachingParam}
  • success : Function (Optional)
    A function to execute if the request succeeds.
  • failure : Function (Optional)
    A function to execute if the request fails.
  • callback : Function (Optional)
    A function to execute when the request completes, whether it is a success or failure.
  • scope : Object (Optional)
    The scope in which to execute the callbacks: The "this" object for the callback function. Defaults to the browser window.
@return {Object} request An object containing the request details.
setupErrorHandling(object) Sets up error handling for the script @private @param {Object} request The request


Name Description
callbackKey @property callbackKey @type String Specifies the GET parameter that will be sent to the server containing the function name to be executed when the request completes. Defaults to callback. Thus, a common request will be in the form of url?
disableCaching @property disableCaching @type Boolean True to add a unique cache-buster param to requests. Defaults to true.
disableCachingParam @property disableCachingParam @type String Change the parameter which is sent went disabling caching through a cache buster. Defaults to '_dc'.
singleton Begin Definitions
timeout @property timeout @type Number A default timeout for any JsonP requests. If the request has not completed in this time the failure callback will be fired. The timeout is in ms. Defaults to 30000.
upErrorHandling Sets up error handling for the script @private @param {Object} request The request
© Copyright 2005-2011 SharpKit. All rights reserved.