[jQuery] How do I run an ajax request on form submit?

[jQuery] How do I run an ajax request on form submit?


Im new with jQuery and I have quite quickly turned a 54 line script
into a 5 line jQuery script :)
However all I want to do now is run an ajax request on the form submit
but the problem I am finding is that it seems the form gets submitted
before the ajax query returns its data - thoughts?
<script type="text/javascript">
$(document).ready(function()
{
    $("form#RegForm").submit(function()
    {
        $.get("gencode.php",function(response)
        {
            response=response.split("\n");
            $("#serialnumber").val(response[0]);
            $("#passcode").val(response[1]);
        });
    return true;
    });
});
</script>
Thanks Jim