I need some help with using JSON and the bitcoin / blockexplorer json calls. I’m not even sure if this is going to work. Basically I’m trying to validate a bitcoin wallet address. I want it to check against the blockexplorer to see if it’s a “valid” address or not.
Here’s what I’ve done so far:
function checkAddress(){
var address = $('#wallet').val();
$.getJSON('http://blockexplorer.com/q/checkaddress/'+address+'?format=json',{"format":"json"},function(data){
alert('xxx == '+data);
});
}
But it doesn’t seem to be doing anything at all.. Is it even possible for me to use the blockexplorer with JSON to get the results? I’m incredibly new to bitcoin and I’m not entirely sure what I’m doing.
The full URL should be something like this: http://blockexplorer.com/q/checkaddress/1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD – if true it returns 00
Here’s the page itself with the error codes:
The URL isn’t returning JSON. You’ll want to use $.get or $.ajax instead, and just look at the pure text that’s returned.