Form submit not happening when I set target attribute using jquery
<p>I have the form inside iframe, I have the following piece of code</p>

<pre><code>&lt;script type="text/javascript"&gt;
var Path="&lt;?= $this-&gt;url ?&gt;"
$(function()
{
    vReg=0
    $("#signin").submit(function()
    {
        if(vReg == 1)
        {
            return true;
        }
        else{ 
        var url = Path;
        var data = {};
        $("input").each(function()
        {
            data[$(this).attr('name')] = $(this).val();
        });
        $("select").each(function()
        {
            data[$(this).attr('name')] = $(this).val();
        });
                $.post(url,data,function(resp)
        {
            vError=""
            for(id in resp){
                oResp=resp[id];
                for(key in oResp){
                    vError +=oResp[key]+"\n"
                }
            }

            if(vError == ''){
                vReg=1;
                           $("#formid").attr('target','_top');
                $("#signin").submit();
                                return true;
            }
            else{
                            $("#formid").attr('target','_self');
                alert(vError)
                }
                         return false;
        },'json');

        return false;
        }
    });
});

&lt;/script&gt;
</code></pre>

<p>My aim is, If I have no Error, I will apply this target attribute and then immediately submit the form which takes the page to parent page. But I got target attribute when I click form submit for the first time,again click the second time its now redirecting to parent page.
I need it happens when i click first time itself.</p>

<p>Kindly help</p>
