I need to display the total downloads of my tool, hosted on SourceForge.
They have an API to return the data in JSON format. But the returned data has a lot of information, and I just need 1 of them.
This is the URL for SourceForge API, showing the data:
https://sourceforge.net/projects/kaais/files/stats/json?start_date=2013-08-18&end_date=2018-04-19
I was able to do this on a local file, but I can't make it work from an external source.
My HTML file code:
<html>
<title>Total Downloads</title>
<body>
<div id="container">
<div id="output">NO DATA</div>
</div>
<script src="totdwn.js"></script>
</body>
</html>
My totdwn.js file code:
var jcontent = {
"total": 123456789
}
var output = document.getElementById('output');
output.innerHTML = jcontent.total;
This works well, but the data has to be manually inserted into JS file.
I want to fetch the data from the URL. The total
info is the same on the URL, but how do I load it into the jcontent
variable?