I have two ajax that I want to call each other
if my first ajax is:
xhrAddressPoll = $.ajax({
url: api,
data: {
address: address,
longpoll: longpoll
},
dataType: 'json',
cache: 'false',
success: function(data){
updateText('yourHashes', (data.stats.hashes || 0).toString());
updateText('yourPaid', (data.stats.paid));
},
});
if my second ajax is:
$.ajax({
url: CoinPriceAPI,
dataType: 'json',
cache: 'false'
}).done(function(data1) {
coinPrice = data;
updateText('coinPriceBTC', coinPrice.price );
});
how can my two ajax be called to each other?
example for output I want to like this:
updateText('yourPaidBTC', (data.stats.paid * coinPrice.price));
if I do like this:
xhrAddressPoll = $.ajax({
url: api,
data: {
address: address,
longpoll: longpoll
},
dataType: 'json',
cache: 'false',
success: function(data){
updateText('yourHashes', (data.stats.hashes || 0).toString());
updateText('yourPaid', (data.stats.paid));
updateText('yourPaidBTC', (data.stats.paid * coinPrice.price));
},
});
i got error with :
coinPrice is not defined
Thank you for your help!