I use the following to call a solidity contract function in nodejs(v10.14.2) + web3(v0.20.7) + ganache(v1.2.3):
contract.getItemCount(function(err1,result1){
console.log(result1);
}
result1(datatype BigNumber/uint256) do have the value returned from the contract function.
But sometimes i get out of gas error(ganache gas limit is 90000), I then used the following syntax:
contract.getItemCount.sendTransaction({gas: 200000},function(err1,result1){
console.log(result1);
}
It executed(consumed 176424 gas) the function successfully. But result1 now has transaction hash as mentioned here. How should i get the result i.e., value returned by the contract function?