Skip to content

Instantly share code, notes, and snippets.

@jboulhous
Created February 24, 2016 00:34
Show Gist options
  • Save jboulhous/f3af606544e75123c1f5 to your computer and use it in GitHub Desktop.
Save jboulhous/f3af606544e75123c1f5 to your computer and use it in GitHub Desktop.
get gist file with $.ajax
function getGistFile (gist, filename, cb) {
$.ajax({
url: 'https://api.github.com/gists/' + gist,
type: 'GET',
dataType: 'jsonp'
}).success( function(gistdata) {
var content = gistdata.data.files[filename].content;
cb(null, JSON.parse(content))
}).error( function(e) {
cb(e)
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment