I have a very simple smart contract that consists of essentially just a getNum function and a setNum function. The smart contract can be viewed here: https://pastebin.com/ci6mbPDq
I am trying to construct a simple frontend to call it. Essentially, I follow this guide. A working codepen of my frontend (demonstrating the janky functionality) can be found here: https://codepen.io/heh/pen/PeMmKe As you can see in my codepen, I call my getNum function like:
document.getElementById("target").innerText = result.toNumber();
However, I keep getting "0" as the result. On the other hand, my setNum function is able to post a result to the Ropsten blockchain. However, I notice that both function calls seem to be firing off their callback instantly.
Could anyone help me figure out why the function calls return instantly?