What's the best way to abstract this code?
<p>If you look at the code inside the <code>#top_cat</code> and <code>#high_hat</code> sections below, it's obvious that it does the same thing.</p>

<pre><code>$(document).ready(function ()
{

    $('#top_cat').submit(function ()
    {
        $.post($(this).attr('action'), $(this).serialize(), null, "script");
        return false;
    });

    $("#tip_click").click(function()
    {
        $("#high_hat").submit()(function ()
        {
            $.post($(this).attr('action'), $(this).serialize(), null, "script");
            return false;
        });
        return false;
    });

});
</code></pre>

<p>What's the correct syntax to separate the inner code (below) into its own function so that it's callable inside the <code>#top_cat</code> and <code>#high_cat</code> sections without the duplication that exists above?</p>

<pre><code>   $.post($(this).attr('action'), $(this).serialize(), null, "script");
   return false;
</code></pre>
