我发现的问题来自
contract.addNewOrg($("#txtAddThirdAddress").val(),$("#txtAddThirdName").val(),6,(req,res)=>{
//Add Third Party Verification Org
$('#btnAddThird').click( function() {
$("#lblResultAddOrg").html("") ;
contract.addNewOrg($("#txtAddThirdAddress").val(),$("#txtAddThirdName").val(),6,
(req,res)=>{
$("#lblResultAddOrg").html(" Registered!!");
localStorage["LoggedInUserType"] = 2; //TPVA
window.location.href="index.html";
})
});
非常感谢您的回复。我仍在学习代码。
下面是加载合约:
var contract = "";
if (typeof web3 !== 'undefined') {
web3 = new Web3(web3.currentProvider);
} else {
// Set the provider you want from Web3.providers
web3 = new Web3(new
Web3.providers.HttpProvider("http://localhost:8545"));
}
window.ethereum.enable()
.then(function (accounts) {
console.log(accounts[0]);
web3.eth.defaultAccount = accounts[0];
var contractabi = new web3.eth.Contract([ABI], 'address');
console.log(contract);
})