Skip to content

Instantly share code, notes, and snippets.

@bhachauk
Created January 10, 2020 14:45
Show Gist options
  • Save bhachauk/b1c16acae88dff5a3b289e7fe23dc2dc to your computer and use it in GitHub Desktop.
Save bhachauk/b1c16acae88dff5a3b289e7fe23dc2dc to your computer and use it in GitHub Desktop.
StackOverflow information
<h3>Stack overflow Repuration</h3>
<div id="stack-rep">Value</div>
<script>
function getJSON(url) {
var resp ;
var xmlHttp ;
resp = '' ;
xmlHttp = new XMLHttpRequest();
if(xmlHttp != null)
{
xmlHttp.open( "GET", url, false );
xmlHttp.send( null );
resp = xmlHttp.responseText;
}
return resp ;
}
myinfo = JSON.parse(getJSON('https://api.stackexchange.com/2.2/users/8331235?order=desc&sort=reputation&site=stackoverflow'));
console.log(myinfo.items[0].reputation);
document.getElementById("stack-rep").title = myinfo.items[0].reputation;
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment