Core Docs | Additional Modules Docs
@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: Determines if the script is auto garbage collected or not
@File: json/xsite.js
@Description: The callback function that the json data is passed to
@File: json/xsite.js
@Description: Loads the json data from the url
@File: json/xsite.js
@Description: Converts a string or object to json.
@File: json/encode.js
@Author: Paul Visco v1.02 02/09/09 Taken from http://devers.blogspot.com/2007/09/worlds-smallest-tojson-function.html
@Param: String x A String, array or object to convert to JSON
@Return: String in JSON format
@Example:var f = {
name : 'fred'
};
sb.json.encode(f);
@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);
}
}
});
@Description: Calls for cross site json data to load into a local callback function via script tag
@File: json/xsite.js
@Version: 1.0 07-27-09 07-29-09
@Param: Object params An objectw ith all the properties of the swf should have once embedded
url - the url of the json data
callback - The callback function to pass the json data to
data - Additional post data to pass to the url, is GET data and must adhere to GET data length restrictions
@Return: Object A sb.json.xsite instance with the properties specifed in the param argument and by sb.json.xsite.prototype
@Example:var xsite = new sb.json.xsite({
url : 'http://somesite.com/get_user/78',
data : {
'dog' : 'big'
},
callback : function(json){
alert(json.uname);
}
});
xsite.fetch();
//to test with test data
xsite.fetch({uname: 'paul'});