Use variable in jquery object
<p>i have this code        </p>

<pre><code>if($("input[name='staylogged']").is(":checked")){
        var staylogged = "yes";
        }else{
        var staylogged = "false";
        }

        var form_data = {
            username: $("#username").val(),
            password: $("#password").val(),
            staylogged
        };
</code></pre>

<p>but the var staylogged in form_data doesn't work as expected where is the error?</p>

<p>i don't know how to declare the var staylogged in form_data</p>
