This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.submitVote = function(candidate) { | |
let candidateName = $("#candidate-name").val(); | |
let signature = $("#vote-signature").val(); | |
let voterAddress = $("#voter-address").val(); | |
$("#msg").html("Vote has been submitted. The vote count will increment as soon as the vote is recorded on the blockchain. Please wait.") | |
Voting.deployed().then(function(contractInstance) { | |
contractInstance.voteForCandidate(candidateName, voterAddress, signature, {gas: 140000, from: web3.eth.accounts[0]}).then(function() { | |
let div_id = candidates[candidateName]; | |
console.log(div_id); | |
return contractInstance.totalVotesFor.call(candidateName).then(function(v) { | |
console.log(v.toString()); | |
$("#" + div_id).html(v.toString()); | |
$("#msg").html(""); | |
}); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment