diff options
author | Camil Staps | 2015-05-20 15:50:55 +0200 |
---|---|---|
committer | Camil Staps | 2015-05-20 15:50:55 +0200 |
commit | a32db2aa56034f26397c17dcb65db36410f5536c (patch) | |
tree | 07216c35f3cdb8356d43525c350a254f51788f58 /src/js/Botleagues.js | |
parent | Initial commit (diff) | |
parent | jquery-cookie (diff) |
Merge branch 'frontend-only' of ../../Botleagues_old
Diffstat (limited to 'src/js/Botleagues.js')
-rw-r--r-- | src/js/Botleagues.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/js/Botleagues.js b/src/js/Botleagues.js new file mode 100644 index 0000000..f9d34b7 --- /dev/null +++ b/src/js/Botleagues.js @@ -0,0 +1,26 @@ +function Botleagues(){} + +Botleagues.url = 'https://api.local.botleagues.camilstaps.nl'; + +Botleagues.request = function(user_options, callback) { + var options = { + endpoint: null, + method: 'GET', + dataType: 'json', + complete: function(data) { + callback(data.responseJSON); + } + }; + for (var name in user_options) { + options[name] = user_options[name]; + } + + var url = Botleagues.url + '/' + options['endpoint']; + delete options['endpoint']; + + jQuery.ajax(url, options); +}; + +Botleagues.redirect = function(user_options) { + window.location = Botleagues.url + '/' + user_options['endpoint']; +};
\ No newline at end of file |