Conduit API
Case Study
HTML Apps -> CrossDomainHttpRequest
 
This function is used to send http requests using Ajax to retrieve information from another domain. After the request finishes a callback function is called. The function gets two parameters: the strData containing the response body and httpCode describing the http status code.
 
CrossDomainHttpRequest(callback, method, url, postParams, userName, password, headersArr).
 
Parameter Description Range Type
callback A callback function to be called when the request is completed A function with two parameters:
strData - contains the response body
httpCode - the status of the call: 200 for OK, other for an error.
function
method The Http request type [GET/POST] string
url The URL of the web service requested A valid URL string
postParams POST data in case of a POST request (optional) Null, or a string string
username In case basic authentication is required by the remote server you can specify the username (optional) Null, or a string string
password In case basic authentication is required by the remote server you can specify the password (optional) Null, or a string string
headersArr An array of headers that can be added to the request (optional) An array of key-value objects, or NULL if not used. For example: arr[0] = new header(‘key’,’value’); Header[]
 
  • Boolean (Succeeded or not)
  • Callback function is called
 
This function requires special permissions. You will need to apply the following security settings for your toolbar.
*Notice: API methods must be invoked after the web page has triggered the "onload" event.
 
This example contains two buttons: clicking on the left button will demonstrate a cross-domain call to an external website (outside of current domain). Clicking on the right button will attempt to create an HTTP request to a non-valid domain.