API jQuery.get seems simple but I can't get it

85 Views Asked by At

Very new to API, and I'm sure I'm not doing this right - I know because it's not working! I just want to use jQuery's get to pull that simple API and spit it out. This is my first dabble in API. I read the documentation but I'm obviously not understanding it right. Thanks for any assitance.

$.get("http://dogechain.info/chain/Dogecoin/q/addressbalance/DT4FWFTjrAA4AvFtkPbVJK3ApYtPHcNnC8", function(data) {
  alert(data);
});
1

There are 1 best solutions below

0
On
$.getJSON('http://whateverorigin.org/get?url=' + encodeURIComponent('http://dogechain.info/chain/Dogecoin/q/addressbalance/DT4FWFTjrAA4AvFtkPbVJK3ApYtPHcNnC8') + '&callback=?', function(data){
    alert(data.contents + ' doges');
});

The problem is the same-origin policy, which doesn't allow you to load content from other domains.This method uses http://whateverorigin.org to get the info.

To the moon!