Following asynchronous function call returns value of total votes in variable v correctly
return GlobalcontractInstance.totalVotesFor.call(candidateName).then(function(v) {
$("#" + div_id).html(v.toString());
$("#msg").html("");
});
But following synchrounous function does not return value in no_of_votes.
no_of_votes = GlobalcontractInstance.totalVotesFor.call(candidateName);
$("#" + div_id).html(JSON.stringify(no_of_votes));
I am not able to figure out why it is happening so ? What is preferable way to call a smart contract functions?