@Description: Dispatches a json.rpc2.request via ajax for local, or script for http
@File: json/rpc2.js
@Param: sb.json.rpc2.request, onResponse
@Example:client.dispatch(new sb.json.rpc2.request({
method : 'current_user',
params : ['reid'],
onResponse : function(json){
if(json.error){
alert(json.error.message);
} else {
alert(json.result);
}
}
}));
@Description: Makes a request to a JSON rpc2 server
@File: json/rpc2.js
@Author: Paul Visco v1.02 02/09/09
@Param: Object o
o.debug boolean Debugs message to sb.consol
o.url String the url to send the request to
o.request sb.json.rpc2.request An instance of sb.json.rpc2.request that makes up the request
o.onResponse The function that fires when the data is returned
@Return: String in JSON format
@Example:var client = new sb.json.rpc2.client({
url : '/directory/json_service'
});
@Description: Models a JSON rpc2 request
@File: json/rpc2.js
@Author: Paul Visco v1.02 02/09/09
@Param: Object o
o.method String The name of the remote procedure (method) to call
o.params Array/Object Either an array or object with the values to send
o.onResponse The callback handler to manage the data
@Return: JSON object with preoprties id, result or id and error. The result holds the result from the remote procedure. If there is an error, the response has an error object property, that in turn has a code and message property.
@Example:var request = new sb.json.rpc2.request({
method : 'add',
params : [1,2],
onResponse : function(json){
if(json.error){
alert(json.error.message);
} else {
alert(json.result);
}
}
});