form submits before onsubmit function has finished
<p>I'm calling the JavaScript function onsubmit of form but form has submit before finished the submit function.If I use the alert in the onsubmit function it finish the function first then submit the form.I used the settimeout function in place of alert but it didn't work.How can I submit the form after the onsubmit has complete.</p>

<pre><code>function chat1close(name){
    var abc;
    abc=window.frames[0].test();
    $.ajax({
        type:'GET',
        url:'modules/closechat.php?abc='+abc+'&amp;name='+name,
        success:function(data){

        }
    });
    document.getElementById("hello").innerHTML=" ";
    alert("yes");
    return true;
}
</code></pre>
