Okey, i have gotten some data from 2 different JSON files, and i want to take one of them and divide with the other, how can i do that? I want to divide the 'sugString' with the 'htmlString'. And after i have done that i want to insert it into a different id like i have done with each of them already.
var flamingSkull = document.getElementById("flaming-skull");
var flamingSkullq = document.getElementById("flaming-skullq");
var flamingSkullSug = document.getElementById("flaming-skullsug");
var ourRequest = new XMLHttpRequest();
ourRequest.open('GET', 'https://api.opskins.com/IPricing/GetAllLowestListPrices/v1/?appid=433850');
ourRequest.onload = function() {
var ourData = JSON.parse(ourRequest.responseText);
renderFlamingSkull(ourData);
};
ourRequest.send();
var ourRequest2 = new XMLHttpRequest();
ourRequest2.open('GET', 'https://api.opskins.com/IPricing/GetPriceList/v1/?appid=433850');
ourRequest2.onload = function() {
var ourData2 = JSON.parse(ourRequest2.responseText);
renderFlamingSkullSug(ourData2);
};
ourRequest2.send();
function renderFlamingSkullSug(data) {
var sugString = data.response[ 'Skin: Flaming Skull Face Bandana' ][today].price / 100;
flamingSkullSug.insertAdjacentHTML('beforeend', "$" + sugString);
}
function renderFlamingSkull(data) {
var htmlString = data.response[ 'Skin: Flaming Skull Face Bandana' ].price / 100;
var quantityString = data.response[ 'Skin: Flaming Skull Face Bandana' ].quantity;
flamingSkull.insertAdjacentHTML('afterbegin', "$" + htmlString);
flamingSkullq.insertAdjacentHTML('beforeend', "<p>(" + quantityString + ")</p>");
}