submiting form on document load
<p>I am trying to submit a form after the document is loaded. Why isn't this piece of code not working? </p>

<p>[EDIT]: The page is resubmitting to itself</p>

<p>[EDIT]: I am running on <code>Ubuntu 10.10 Firefox 3.6</code></p>

<pre><code>&lt;form id="myform" name="myform" action="chat.php" method="post"&gt;
    &lt;input type="hidden" name="displayname" id="displayname"/&gt;
&lt;/form&gt;

&lt;script type="text/javascript"&gt;
$(document).ready(function (){
    promptusername();
});

function promptusername()
{
    $('#displayname').val(prompt("Enter your display name"));
    //if($('#displayname').val() != null){
        $('#myform').submit();
    //}
    //else{
        //promptusername();
    //}         
}
&lt;/script&gt;
</code></pre>
