Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
get file from github via ajax and github api [não está pronto]
<!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