Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have created a HTML table

<table id="top_five_table">
 <tr>
 <td> </th>
 <th>URL</th>
 <th width="90">Total Hits</th>
 <th width="380">Percentage of all Hits</th>
 </tr>

 <tr>
 <td></td>
 <td></td>
 <td></td>
 <td></td>
 </tr>              
</table>

and this is my json object array

json_object = None
json_object = {'url_name': url_name, 'total_count': entity.total,\
'url_id': url_id,
'percentage': percentage, 'facebook_count': entity.facebook_count,\
'twitter_count': entity.twitter_count, \
'buzz_count': entity.buzz_count, \
'linkedin_count': entity.linkedin_count, \
'digg_count': entity.digg_count,\
'delicious_count': entity.delicious_count,\
'reddit_count': entity.reddit_count}
json_array.append(json_object)

from a java script im extracting the json object as follows

var json_array = data.json_array;
var table = document.getElementById('top_five_table');
var rowCount = table.rows.length;
var colCount = table.rows[0].cells.length;

I wont to populate my HTML Data table dynamically using Java script or JQuery and im so new to these two technologies. I do not know how populate the table dynamically . Can any one help?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

The basics off this is below you will just need to change content to your data.

    //EQ The row off the table
    var row = $("#top_five_table tr").eq(1);

var i=0;
while (i<=3){
    //EQThe col off the table
        var col = $(row).find("td").eq(i).html("content");
i++;
}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.