Bitcoin Forum
June 07, 2024, 05:30:55 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Can I call the blockchain.info API with just javascript or jQuery?  (Read 686 times)
MA5H3D (OP)
Member
**
Offline Offline

Activity: 99
Merit: 10


View Profile
May 30, 2014, 02:22:00 PM
 #1

Can I call the blockchain.info API with just javascript or jQuery?

I'm trying to load http://blockchain.info/unspent?active=$address. From what i've read it should be possible somehow with cors, but i've been checking urls with this cors test: http://client.cors-api.appspot.com/client, and with or without the "?cors=true" i'm not having much luck.

Has anyone got this to work?
coretechs
Donator
Sr. Member
*
Offline Offline

Activity: 362
Merit: 250



View Profile
May 30, 2014, 03:18:19 PM
 #2

You need to use an ampersand for query parameters: "&cors=true"

ex -
Code:
$.getJSON("http://blockchain.info/unspent?active=1CjPR7Z5ZSyWk6WtXvSFgkptmpoi4UM9BC&cors=true", function (data) { alert(JSON.stringify(data)); });

https://bitcoindoc.com - The Rise and Rise of Bitcoin | https://blocktap.io - Lightning powered crypto query engine
MA5H3D (OP)
Member
**
Offline Offline

Activity: 99
Merit: 10


View Profile
May 30, 2014, 04:25:24 PM
 #3

@coretechs
I've tried a lot of variations and nothing seems to work. I still get this in the console:

Quote
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://blockchain.info/unspent?active=1CjPR7Z5ZSyWk6WtXvSFgkptmpoi4UM9BC&cors=true. This can be fixed by moving the resource to the same domain or enabling CORS.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!