From cdb7b4111901c54a9c18b6df5638d6f4cf25419f Mon Sep 17 00:00:00 2001 From: chaturanga-at-369811878976 Date: Thu, 2 Feb 2017 13:06:39 +0530 Subject: [PATCH] Access-Control-Allow-Origin error while connecting to api fixed --- website_example/pages/home.html | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/website_example/pages/home.html b/website_example/pages/home.html index 17b9c1354..9fcffeaba 100644 --- a/website_example/pages/home.html +++ b/website_example/pages/home.html @@ -277,7 +277,7 @@

Payments

- /* Market data polling */ +/* Market data polling */ var intervalMarketPolling = setInterval(updateMarkets, 300000); //poll market data every 5 minutes var xhrMarketGets = {}; @@ -287,7 +287,13 @@

Payments

var marketsData = []; for (var i = 0; i < cryptonatorWidget.length; i++){ (function(i){ - xhrMarketGets[cryptonatorWidget[i]] = $.get('https://www.cryptonator.com/api/ticker/' + cryptonatorWidget[i], function(data){ + cryptonatorWidget[i] = cryptonatorWidget[i].replace('{symbol}', lastStats.config.symbol.toLowerCase()); + xhrMarketGets[cryptonatorWidget[i]] = $.get('https://api.cryptonator.com/api/ticker/' + cryptonatorWidget[i], function(data){ + if(data.error) { + return; + } + $('.marketRate').show(); + marketsData[i] = data; completedFetches++; if (completedFetches !== cryptonatorWidget.length) return; @@ -311,7 +317,6 @@

Payments

- /* Hash Profitability Calculator */ $('#calcHashRate').keyup(calcEstimateProfit).change(calcEstimateProfit);