Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Request() {
- this.url = app.serviceUrl;
- this.send = function(method, type, params, callback) {
- console.log(method);
- //console.log(type);
- //console.log(params);
- localMethod = method.replace('/', '');
- if(dummy[localMethod] !== undefined) {
- console.log('local');
- callback(dummy[localMethod]);
- } else {
- console.log('online');
- url = this.url+method;
- console.log(url);
- console.log('request sent: '+ url);
- $.ajax({
- type: type,
- url: url,
- data: params,
- dataType: 'json'
- })
- .done(function(data) {
- if(callback) callback(data);
- });
- }
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement