Refresh div content on form submit (ajax)
<p>On my page I have a form that inserts a new record in to the database. On the same page there is a DIV that contains the current resultset.</p>

<p>What I am trying to do is refresh just that DIV (not the whole page) when the form is submitted. The DIV will then contain the latest records (including the one just added).</p>

<pre><code>$('#add-variants-form').submit(function(){
    $.ajax({
        url: 'admin/addvariants',
        type: 'POST',
        dataType: 'html',
        data: $(this).serialize(),
    });

    return false;
});

&lt;div id="current-rows"&gt;
&lt;?php while($variant=mysql_fetch_array($variants)) { ?&gt;
    &lt;div class="row"&gt;
    // resultset        
    &lt;/div&gt;
&lt;?php } ?&gt;
&lt;/div&gt;
</code></pre>

<p>I set <code>$variants</code> from within my controller (beforehand):</p>

<pre><code>$variants=Catalog::getProductVariants($product['id']);
</code></pre>

<p>Ideally I don't want to be returning a whole load of HTML to be injected in to that DIV.</p>
