How to get the result from a function of contract in java script?

iostreameriostreamer Member Posts: 4
I have a contract like this :

contract Register{

mapping (string => address) nameMap;
mapping (address => string) addressMap;
function doit(string name) returns (string s){
nameMap[name] = msg.sender;
addressMap[msg.sender] = name;
return ("Success");
return ("Failure");


function getAddress(string name) returns (address addr){
return nameMap[name];

function getName(address addr) returns (string name){
return addressMap[addr];

And I can't figure out how to use the result of doit() in java script. I am using the embark framework and when I tried to use the binding directly, all I got was
the Tx hash. Please help regarding this.

Thank you


Sign In or Register to comment.