Bitcoin Wallet address validation using Json and bitcoin blockexplorer

0 votes

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. I have written this code but its not working:

function checkAddress(){

  var address = $('#wallet').val();

  $.getJSON('http://blockexplorer.com/q/checkaddress/'+address+'?format=json',{"format":"json"},function(data){

    alert('xxx == '+data);

  });

}

Can someone tell me how to do it?

Aug 20, 2018 in Blockchain by digger
• 26,740 points
2,375 views

1 answer to this question.

0 votes

The URL isn't returning JSON. So instead of using $.getJSON, use $.get or $.ajax.

function checkAddress(){

  var address = $('#wallet').val();

  $.get('http://blockexplorer.com/q/checkaddress/'+address,function(data){

    alert('xxx == '+data);

  });

}

This should work.

answered Aug 20, 2018 by slayer
• 29,370 points

Related Questions In Blockchain

0 votes
1 answer

How to get all address and send ethers in solidity using a loop?

I found a similar code somewhere: contract  Holders{ uint ...READ MORE

answered Jul 31, 2018 in Blockchain by digger
• 26,740 points
2,768 views
0 votes
1 answer

Bitcoin: parsing Blockchain API using JSON

Because you only add one address to ...READ MORE

answered Aug 22, 2018 in Blockchain by digger
• 26,740 points
3,330 views
+1 vote
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
1,442 views
0 votes
0 answers

how to Build Bitcoin address and balance database?

How to build Bitcoin Address and Balance ...READ MORE

Jul 25, 2019 in Blockchain by Raj
• 180 points
1,093 views
+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,740 points
45,295 views
0 votes
1 answer

How do I add multiple recipients for transactions via Blockchain API?

Convert the recipes into JSON objects. x = ...READ MORE

answered Jul 6, 2018 in Blockchain by Perry
• 17,100 points
924 views
0 votes
1 answer

Python request module for bitcoin json rpc

This should work: #!/usr/bin/env python import getpass import json import requests ...READ MORE

answered Aug 28, 2018 in Blockchain by digger
• 26,740 points
2,383 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
1,942 views
0 votes
1 answer

How to generate coin address using bitcoin-ruby?

The only difference between the addresses is ...READ MORE

answered Aug 29, 2018 in Blockchain by slayer
• 29,370 points
840 views
+1 vote
3 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP