Last active
August 5, 2017 22:38
-
-
Save blairanderson/444e40f2475558ffdc9b94b3dfcdac3a to your computer and use it in GitHub Desktop.
Fetching a GitHub Repo Readme with AJAX (example)
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
function success(data, status, xhr) { | |
$('#readme-content').html(data); | |
} | |
function error(data, status, xhr) { | |
$('#readme-content').remove(); | |
} | |
$.ajax({ | |
dataType: 'text', | |
url: 'https://api.github.com/repos/{{page.repo}}/readme', | |
headers: { Accept: 'application/vnd.github.v3.html' }, | |
success: success, | |
error: error | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment