Because it puts it in the javascript and lets you easily manipulate it
with javascript.  If you get html back from the server, it's more
difficult to manipulate.

$.getJson('path/to/url',  function(data) {
    var tableHTML = '<table>';
    $.each(data.aaData, function() {
         tableHTML += '<tr><td>' + this[0] + '</td><td>' + this[1] +
'</td></tr>';
    });
    tableHTML += '</table>';
    $('#placeToInsert').append(tableHtml);
});



On Mar 14, 12:30 pm, donb <falconwatc...@comcast.net> wrote:
> If that's all your going to do with it, why not return a table from
> the server and simply .load() it?  No transformation required in that
> case.
>
> On Mar 14, 9:23 am, finco <mbeck...@gmail.com> wrote:
>
> > Sorry if this is a duplicate post - doesn't look like the last one
> > went through.
>
> > I've seen several examples of how to process json data with .each when
> > the field names come over with json.  My data, howver, looks like the
> > following:
>
> > {"aaData": [
> > ["1001-00-1535.000","Tenant Improvements"],
> > ["1001-00-1558.000","Selling costs"],
> > ["1001-00-1560.000","Financing Fees"],
> > ["1001-00-1560.001","Financing Fees - Legal"],
> > ["1001-00-1565.000","Lease Costs"],
> > ["1001-00-1565.001","Lease Costs -Legal"],
> > ["1001-00-1565.002","Lease Costs - Brokerage"],
> > ["1001-00-1570.000","Legal Fees"]
> > ]}
>
> > How would I drop this data into a table?
>
> > Thanks in advance for your help.

Reply via email to