Need to convert bitcoin address function from php to Jquery

0 votes

I want to convert this function from php to JQuery. I tried a few things but I am not able to get it right

<?php
function getBalance($adress) {
    return file_get_contents('https://blockchain.info/de/q/addressbalance/'. $adress);
}

$addy1_balance = getBalance('19F16Tg47PUsie2vNzkjJn5xsgjAPU3z2f') / 100000000;
$addy2_balance = getBalance('17jJBRxVdNX4uP2gjs5t9LEMJ56zAXK7iC') / 100000000;
$addy3_balance = getBalance('13FBnfCFvJmketncTwr2csXJrzwU4wPLqe') / 100000000; 
$addy4_balance = getBalance('17tGnUhPNTF1L2NpfmmKWLFQS5teRGJSaf') / 100000000; 

?>


echo $addy1_balance;
echo $addy2_balance;
echo $addy3_balance;
echo $addy4_balance;
Sep 5, 2018 in Blockchain by slayer
• 29,310 points
255 views

1 answer to this question.

0 votes

Use AJAX. It will be easier to use a library like jQuery. With jQuery you can use jQuery.getJSON. It only works if blockchain.info allow cross domain call.

jQuery.getJSON('https://blockchain.info/de/q/addressbalance/17jJBRxVdNX4uP2gjs5t9LEMJ56zAXK7iC', function(result) {
alert(result);
});
answered Sep 5, 2018 by digger
• 26,720 points

Related Questions In Blockchain

0 votes
1 answer

Is there a way to send funds from a specific bitcoin address in a wallet?

I'll answer my own question, It was unbelievably ...READ MORE

answered Sep 3, 2018 in Blockchain by Perry
• 17,100 points
622 views
+2 votes
1 answer

how to convert hash160 to bitcoin address in python?

Hey @Raj. I use the following script. ...READ MORE

answered Jul 12, 2019 in Blockchain by Tanisha
2,104 views
0 votes
1 answer

(bitcoin) Calculate hash from getwork function - how to do it?

This is correct as there is a ...READ MORE

answered Feb 28 in Blockchain by Soham
• 8,730 points
65 views
0 votes
0 answers
+1 vote
3 answers

Removing double quotes from a string from JSON response in PHP

Just remove the json_encode call, and it should work: $resp ...READ MORE

answered Sep 12, 2018 in Blockchain by digger
• 26,720 points
32,759 views
0 votes
1 answer

How to create Bitcoin Address in PHP?

You need to understand that Bitcoin address and ...READ MORE

answered Aug 28, 2018 in Blockchain by Perry
• 17,100 points
3,741 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
960 views
0 votes
1 answer

How to extract h160 address of bitcoin blockchain?

You can extract the data using the ...READ MORE

answered Jul 16, 2018 in Blockchain by digger
• 26,720 points
1,506 views
0 votes
1 answer

Cant Decode Bitcoin Base58 address to byte array

In your for-loop: for (int k = b256.Length ...READ MORE

answered Aug 21, 2018 in Blockchain by digger
• 26,720 points
493 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP