New issue:
I am trying to call an event and log the results on the Frontend but every time I try to do this the site doesn’t respond with the results. Here is the code:
.then(contractInstance.getPastEvents(‘Results’,
{
fromBlock:‘latest’
},function(error, events){
console.log(events); })).then(function(events){
$("#get_results_output").text(events._results);
When I try $("#get_results_output").text(events), that works but of course that only returns the text object on the page.
P.S.
What I’m trying to return is a string that says either “You Won!” or “Sorry Try Again!”
Update: I figured it out. The solution is:
.then(contractInstance.getPastEvents(‘Results’,
{
fromBlock:‘latest’
},function(error, _events){
console.log(_events); })).then(function(_events){
$("#get_results_output").text(_events.events.Results.returnValues[’_results’]);
});
When I run this however, in the console.log the event is from the last transaction and not the current one. How do I fix this?
Screen Shot 2021-01-31 at 11.28.16 PM|690x419