Created
February 24, 2016 00:34
-
-
Save jboulhous/f3af606544e75123c1f5 to your computer and use it in GitHub Desktop.
get gist file with $.ajax
This file contains hidden or 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
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