[ad_1]
This is my jQuery script to interact with Smart Contract:
$(document).ready(function () {
const abi = [
#ABI HERE
];
const scAddress = "#ADDRESS HERE";
const web3 = new Web3('http://127.0.0.1:9545');
window.ethereum.enable();
var contractMM = new web3.eth.Contract(abi, scAddress);
console.log(contractMM);
In the console, it can log the contractMM
but when I call function like:
contractMM.methods.name().call()
It shows
Uncaught ReferenceError: contractMM is not defined
at <anonymous>:1:1
Can anyone help me with this?
[ad_2]