Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: JetRX on August 15, 2015, 05:53:19 PM



Title: Check address balance with JavaScript?
Post by: JetRX on August 15, 2015, 05:53:19 PM
How to do it?


Title: Re: Check address balance with JavaScript?
Post by: hexafraction on August 15, 2015, 11:36:05 PM
Both blockchain.info and blockr.io have APIs you can use for this purpose. You can load https://blockchain.info/address/{ADDRESS HERE}?format=json or http://btc.blockr.io/api/v1/address/info/{ADDRESS HERE} using AJAX and parse the JSON.


Title: Re: Check address balance with JavaScript?
Post by: Kazimir on August 16, 2015, 05:01:50 AM
Both blockchain.info and blockr.io have APIs you can use for this purpose. You can load https://blockchain.info/address/{ADDRESS HERE}?format=json or http://btc.blockr.io/api/v1/address/info/{ADDRESS HERE} using AJAX and parse the JSON.
Ajax doesn't allow you to make requests to another domain. So if your site is on example.com, your javascript can't query an external URL like btc.blockr.io.


Title: Re: Check address balance with JavaScript?
Post by: luisan00 on August 16, 2015, 09:50:36 AM
Quote
Ajax doesn't allow you to make requests to another domain. So if your site is on example.com, your javascript can't query an external URL like btc.blockr.io.
What?? ??? ???
Today, cross domain Ajax request is supported for major browsers.
You can use several resources for a request cross domain , for example: JSONP, OpenAjax Hub, easyXDM, etc, also proxified petitions can help, or simply type in google CORS, cross domain, etc etc.