Created
July 15, 2013 19:37
-
-
Save lavarini/6002753 to your computer and use it in GitHub Desktop.
Get Songbook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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