Created
May 12, 2017 22:35
-
-
Save jonatasemidio/8633fca4584c36fcddcf1a1d636bb822 to your computer and use it in GitHub Desktop.
get file from github via ajax and github api [não está pronto]
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<script | |
src="https://code.jquery.com/jquery-3.2.1.min.js" | |
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" | |
crossorigin="anonymous"></script> | |
<title>Get File From Github</title> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
$( document ).ready(function() { | |
// Handler for .ready() called. | |
alert("oi"); | |
var response = ''; | |
$.ajax({ type: "GET", | |
url: "https://raw.githubusercontent.com/github/gitignore/master/Actionscript.gitignore", | |
async: false, | |
success : function(text) | |
{ | |
response = text; | |
} | |
}); | |
alert(response); | |
$.ajax({ | |
url:"https://api.github.com/repos/github/gitignore/contents/", | |
dataType:"jsonp", | |
success: function(results){ | |
console.log(results) | |
} | |
}); | |
alert("fim"); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment