setting a var and return new value at once
<p>I run in to a problem whan i do somthing like this</p>

<pre><code>var abc = false;
function doSomthing(){
abc = true;
return abc;
}
</code></pre>

<p>and it returns false, but if i run the function twice (in console), the second time returns true.</p>

<p>Thanks</p>

<p>the orignal function</p>

<pre><code>var session_id_resualt = false;

function islogdin() {
    if (localStorage.email == undefined) {
        localStorage.email = "";
    }

    if (localStorage.session_id == undefined) {
        localStorage.session_id = "";
    }

    $.post(server + "loginCheck.php", {
        loginCheck: "",
        cookie: readCookie("h"),
        session_id: localStorage.session_id,
        email: localStorage.email
    },

    function (json) {
        json = $.parseJSON(json);
        if (json.logdin) {
            if (json.logdin == "1") {
                //var s_id = json.session_id;
                session_id_resualt = json.session_id;
                //return s_id;          
            } else {
                session_id_resualt = false;
                //  return false;
            }

        } else {
            session_id_resualt = false;
            //  return false;
        }
    });
    return session_id_resualt;

}
</code></pre>
