有这样一段代码,功能是监听一个表单的提交事件。可是点击提交时,就会报错
$("#bidding").submit(event=>{
$("#msg").hide();
let amount = $("#bid-amount").val();
let sendAmount = $("#bid-send-amount").val();
let secretText = $("#secret-text").val();
let sealedBid = web3.sha3(web3.fromWei(amount, 'ether').toString() + secretText);
let productId = $("#product-id").val();
//console.log(sealedBid + " for " + productId);
EcommerceStore.deployed().then(i=>{
console.log(amount )
console.log(sendAmount )
console.log(parseInt(productId))
//前面应该没有问题,应该是下面有问题,可是不知道怎么错了
//bid为合约中这样一个函数function bid(uint _productId, bytes32 _bid) payable public returns (bool)
i.bid(parseInt(productId), sealedBid, {from: web3.eth.accounts[0],value: web3.toWei(sendAmount,'ether') }).then(
function(f) {
$("#msg").html("Your bid has been successfully submitted!");
$("#msg").show();
console.log(f)
}
)
});
event.preventDefault();
});
报错如下
Error: Invalid JSON RPC response:
TypeError: t is not a function