I have been trying to listen to the event of my smart contract; however, I receive the error.
MyContract.events.myEvent(
function(error, event){
if(!error){
$("#instructor").html(event.args.name + ' (' + event.args.age + ' years old)');
}else{
console.log(error);
}
})
I receive the following error
Error: The current provider doesn't support subscriptions:
Web3.js version is [email protected]
I am well aware of the following solution; however, it doesn't work on my case anyway.
My smart contract
contract Coursetro {
string fName;
uint age;
event Instructor(
string name,
uint age
);
function setInstructor(string _fName, uint _age) public {
fName = _fName;
age = _age;
Instructor(_fName, _age);
}
function getInstructor() public constant returns (string, uint) {
return (fName, age);
}
}