not sure if I should post this on the Ethereum SE but I have a feeling it is more javascript related, so I'll try here:
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:
BasicToken.getNum(0x64319ca297239d8652a0b5f0f12dd6666cb0e05b,
function(error, result)
{
console.log(result.toNumber());
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?
Thanks!