JavaScript function returns before JSON result arrives
<pre><code>function GetId() {
    var id;    
    $.post("/Edit/CreateId", function (data) {
        id = data;
    });    
    return id;
}
</code></pre>

<p>But it returns before the id comes back from the server; so id is undefined.</p>

<p>Is there any workaround this?</p>
