How to return a value using context.executeQueryAsync?
<p>How can I get this function to return the value?  In all the examples I have seen, folks use an <code>alert</code> in the delegate functions, but I need to return the value instead.  When I call the function, it fetches me my default string, which means the <code>executeQueryAsync</code> is not setting the variable.  </p>

<p>What am I doing wrong?</p>

<pre><code>var thisuser = SPGetSPcurrentUser();
alert(thisuser);
//-------------------------------------------------------------------
var SPGetSPcurrentUser = function(){
    var spuserid = "Error";
    var context = new SP.ClientContext.get_current();
    this.website = context.get_web();
    this.currentUser = website.get_currentUser();
    context.load(currentUser);
    context.executeQueryAsync(
        function(sender, args){ this.spuserid = currentUser.get_loginName();},
        function(sender, args){ this.spuserid = 'request failed ' + args.get_message() + '\n'+ args.get_stackTrace();}
    )
    return spuserid;
}
</code></pre>
