jquery code for form submit on enter key and without page refresh
<p>I am trying to do something like what happens on facebook.I need to make it for my blog.
The issue with this code given below is that it is not responding to the enter key and hence no further execution. But when i simply use the enter key check code without ajaxForm function it responds.</p>

<p>Code: </p>

<pre><code>$('#msg').keypress(function(e){
   if (e.keyCode == 13 &amp;&amp; !e.shiftKey) {
      //checking for enter key as well as shift+enter
      $(document).ready(function() { 
         $('#form1').ajaxForm(function() {
            //for from id=form1 submitting without refreshing the page
            $('#msg').val(''); //clearing out the textarea with id=msg
           //loading fetchposts.php in id=display with new posts
            $("#displaychat").load("fetchposts.php")
         }); 
      }); 
   }
});​
</code></pre>

<p>In short what i want is that when enter key is pressed the form gets submitted and new results are displayed without page getting refreshed.</p>
