1
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

4

1 回答 1

5

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.

于 2012-06-07T13:18:27.083 回答