I want to send ETH from one account to another using Web3 interface and Infura node. I have tried like below, and I got error 405(). Error: Invalid JSON RPC response: ""
I test it in Rinkeby test network. This is how I initialize Web3 and do the transaction.
<script>
$(document).ready(function () {
const Web3 = require('web3');
const web3 = new Web3(new Web3.providers.HttpProvider('https://rinkeby.infura.io/<Access_Token>'));
$(".btn-send").click(function () {
web3.eth.sendTransaction(
{
to: '0xae8cE2D0B2015Aeb62189822C7eEae2f60B011e5',
from: '0x5ada788989dCa813cBE82eD8bB8d54e1b43327A7',
value: web3.toWei("1", "ether")
},
function (error, transactionHash) {
if (!error) {
console.log("send successfully");
} else {
console.log("Error: " + error);
}
}
);
});
});
</script>