Class Index | File Index

Classes


Namespace ox.JSON


Defined in: configuration.js.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
Method Summary
Method Attributes Method Name and Description
<static>  
ox.JSON.get(uri, ok, error, raw)
Asynchronously requests a JSON object from the server.
<static>  
ox.JSON.post(uri, data, ok, error, raw)
Asynchronously posts url-encoded data and retrieves a JSON object from the server.
<static>  
ox.JSON.put(uri, data, ok, error, raw)
Asynchronously sends a JSON object and retrieves a JSON object from the server.
Namespace Detail
ox.JSON
Method Detail
<static> ox.JSON.get(uri, ok, error, raw)
Asynchronously requests a JSON object from the server. This method retrieves a JSON object from the server by issuing an HTTP GET request to the specified URI and calling the specified callback when the retrieval is complete.
Parameters:
{String} uri
The URI for the HTTP GET request.
{Function} ok
A callback function which is called with the received JSON object or raw data as parameter. If there was any error then this function is not called.
{Function} error
An optional callback function wihch is called when the server returns an error. The function takes two parameters: result and status. If the HTTP status code was 200, then result is the JSON object and status is not set. If the HTTP status was not 200, then result is the status string and status is the HTTP status code. The function should return true when it handles the error. Otherwise, the default error handler specified by JSON.errorHandler will be called after this function returns. If this parameter is not specified, the default error handler is called directly.
{Boolean} raw
Specifies whether the response data should be passed to the callback as-is or first parsed as a JSON object. Defaults to the latter.

<static> ox.JSON.post(uri, data, ok, error, raw)
Asynchronously posts url-encoded data and retrieves a JSON object from the server. This method posts an object to the server by issuing an HTTP POST request to the specified URI and calling the specified callback when the reply arrives.
Parameters:
{String} uri
The URI for the HTTP POST request.
{Object} data
An object which is serialized using the application/x-www-form-urlencoded encoding and sent as the body of the request.
{Function} ok
A callback function which is called with the received JSON object or raw data as parameter. If there was any error then this function is not called.
{Function} error
An optional callback function wihch is called when the server returns an error. The function takes two parameters: result and status. If the HTTP status code was 200, then result is the JSON object and status is not set. If the HTTP status was not 200, then result is the status string and status is the HTTP status code. The function should return true when it handles the error. Otherwise, the default error handler specified by JSON.errorHandler will be called after this function returns. If this parameter is not specified, the default error handler is called directly.
{Boolean} raw
Specifies whether the response data should be passed to the callback as-is or first parsed as a JSON object. Defaults to the latter.

<static> ox.JSON.put(uri, data, ok, error, raw)
Asynchronously sends a JSON object and retrieves a JSON object from the server. This method sends a JSON object to the server by issuing an HTTP PUT request to the specified URI and calling the specified callback when the reply arrives.
Parameters:
{String} uri
The URI for the HTTP POST request.
{Object} data
An object which is serialized using JSON syntax and sent as the body of the request.
{Function} ok
A callback function which is called with the received JSON object or raw data as parameter. If there was any error then this function is not called.
{Function} error
An optional callback function wihch is called when the server returns an error. The function takes two parameters: result and status. If the HTTP status code was 200, then result is the JSON object and status is not set. If the HTTP status was not 200, then result is the status string and status is the HTTP status code. The function should return true when it handles the error. Otherwise, the default error handler specified by JSON.errorHandler will be called after this function returns. If this parameter is not specified, the default error handler is called directly.
{Boolean} raw
Specifies whether the response data should be passed to the callback as-is or first parsed as a JSON object. Defaults to the latter.

Documentation generated by JsDoc Toolkit 2.0.2 on Thu Jul 09 2009 12:58:03 GMT+0200 (CEST)