1

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?

1

1 Answer 1

1

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++;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.