You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
642 B

var ApiClass = new Class({
setup: function(options){
var self = this;
self.options = options;
},
request: function(type, options){
11 years ago
var self = this,
r_type = self.options.is_remote ? 'JSONP' : 'JSON';
return new Request[r_type](Object.merge({
13 years ago
'callbackKey': 'callback_func',
'method': 'get',
'url': self.createUrl(type, {'t': randomString()})
11 years ago
}, options)).send();
},
createUrl: function(action, params){
11 years ago
return this.options.url + (action || 'default') + '/' + (params ? '?'+Object.toQueryString(params) : '');
},
getOption: function(name){
11 years ago
return this.options[name];
}
});
11 years ago
window.Api = new ApiClass();