Reputation: 526
var encodedAccount = '';
function encodeUsername()
{
encodedAccount= encrypt(document.getElementById('account').value);
alert(encodedAccount);
}
the function encrypt is async ajax function. the alert
is not returning a value , it's still ''
Any Idea ?
Thanks
Upvotes: 1
Views: 82
Reputation: 943217
Asynchronous functions generally don't return values. They usually accept a callback function that fires when the function is done (usually when when HTTP response comes back in the case of Ajax).
You need to find out how the encrypt
function expects to be used and conform to its expectations.
Upvotes: 5