Skip to content

Instantly share code, notes, and snippets.

@lavarini
Created July 15, 2013 19:37
Show Gist options
  • Save lavarini/6002753 to your computer and use it in GitHub Desktop.
Save lavarini/6002753 to your computer and use it in GitHub Desktop.
Get Songbook
SS.cifraclub.songbooks = (function (window, $) {
function _getUserSongbooks() {
return $.ajax({
url: SS.api.URL + 'songbook/user/' + SS.ccidbar.user.id + '.json',
type: 'get',
dataType: 'json'
});
};
function _getSongbookById(songbook_id) {
return $.ajax({
url: SS.api.URL + 'songbook/' + songbook_id + '.json',
type: 'get',
dataType: 'json'
});
};
function _getSongbookBySlug(slug) {
return $.ajax({
url: SS.api.URL + 'songbook/user/' + SS.ccidbar.user.id + '/' + slug + '.json',
type: 'get',
dataType: 'json'
});
};
return {
getUserSongbooks: function () {
return _getUserSongbooks();
},
getSongbook: function (a, b) {
if (b == 'slug'){
return _getSongbookBySlug(a);
}
return _getSongbookById(a);
}
};
}(window, jQuery));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment