function getForestData () { $.ajax({ url: `https://eco.skoot.io/api/forest/${handle}`, type: 'GET', dataType: 'json', crossDomain: true, cache: false, contentType: 'application/json; charset=utf-8', headers: { Accept: 'application/vnd.skoot.eco.v1+json' }, statusCode: { 404: failureRedirect }, success: function (responseData) { setData(responseData) } }) } function configureOverview (data) { const stats = data.statistics const treeStatistic = document.getElementById("tree-statistic"); const offsetStatistic = document.getElementById("offset-statistic"); $('#overview-trees-value').text(formatNumber(stats.trees.value)) $('#overview-trees-description').text(stats.trees.title) $('#overview-total-offset-value').text( formatNumber(stats.carbon_offset.value) + ' t' ) $('#overview-total-offset-description').text(stats.carbon_offset.title) function formatNumber (value) { // Convert text to float value let valueToFloat = parseFloat(value) // Round upto 3 decimal places valueRounded = Math.round((valueToFloat + Number.EPSILON) * 1000) / 1000 // Number Formatting to English convention return (statValueFormatted = valueRounded.toLocaleString('en')) } }
0 trees planted
0 t CO2 reduced