Jquery Wrap divs with parent div within $.each
<p>I am trying to wrap each object which will contain a group of <code>div.field</code>(s) with a parent div <code>.row</code>.  Jquery is only allowing me to open and close the parent div on the same line.  Please help!</p>

<pre><code>  $(document).ready(function(){
    $.getJSON('WF-XML.php', function(data) {

        JSON.stringify(data);
        var prevCardCode = '';

        $.each( data, function(index, element){

            if (!(element['CardCode'] == prevCardCode)) {

                var sum = element['payment_sum'];

                    $('#showdata').append('&lt;div class="row"&gt;&lt;div class="field"&gt;' + sum + '&lt;/div&gt;');
                }
                prevCardCode = element['CardCode'];

                $.each(element, function(i, element_detail){
                    if (!(i == 'InvKey' || i == 'PostDate' || i == 'City' || i == 'Objtype' || i == 'Block' || i == 'ZipCode' || i == 'Address' || i == 'payment_sum' || i == 'State1' || i == 'Country' || i == 'NumAtCard')) {
                        var detail = element_detail;
                        $('#showdata').append('&lt;div class="field"&gt;' + detail + '&lt;/div&gt;');
                    }

                });

           });
    });

});
</code></pre>

<p>PHP</p>

<pre><code>  if (($handle = fopen('upload/BEN-new.csv', "r")) === FALSE) {
    die('Error opening file'); 
 }

 $headers = fgetcsv($handle, 1024, ',');
 $complete = array();

      while ($row = fgetcsv($handle, 1024, ",")) {
       $complete[] = array_combine($headers, $row);
        }
    fclose($handle);

    echo json_encode($complete);
</code></pre>

<p>Here is the data:</p>

<pre><code> {"InvKey":"11704","CardCode":"1611704", "payment_sum": "1055.40"},
 {"InvKey":"11703","CardCode":"1611703", "payment_sum": "550.00"}
</code></pre>

<p>Its printing like this:</p>

<pre><code> &lt;div class="row"&gt;
      div class="field"&gt;1055.40&lt;/div&gt;
 &lt;/div&gt;
 &lt;div class="field"&gt;1611704&lt;/div&gt;
 &lt;div class="row"&gt;
 &lt;div class="field"&gt;550.00&lt;/div&gt;
 &lt;/div&gt;
 &lt;div class="field"&gt;1611703&lt;/div&gt;
</code></pre>

<p>I would like it to print like this:</p>

<pre><code>  &lt;div class="row"&gt;
      &lt;div class="field"&gt;1055.40&lt;/div&gt;
      &lt;div class="field"&gt;1611704&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="row"&gt;
      &lt;div class="field"&gt;550.00&lt;/div&gt;
      &lt;div class="field"&gt;1611703&lt;/div&gt;
  &lt;/div&gt;
</code></pre>
