// constructor
function JinnService(url) {
	this.url = url;
}

// call()
JinnService.prototype.call = function(method, parameters, callback, errorCallback) {
	
	// request params
	var params = {method: method, params: JSON.stringify(parameters)}
	
	// function to handle response
	var handler = function(data) {
		if ("response" in data) {
			callback(data.response);
		} else {
			if (errorCallback) errorCallback(data.error);
		}
	};
	
	// POST the request
	$.post(this.url, params, handler, "jsonp");
	
};
