First we need library that can easily handle JSON. For instance, JQuery.
Suppose, we have included core JQuery library.
Here is the htmltable.js
Now all that we need is just to include that htmltable.js file and load any JSON like that:
function dynamicTable(URL, id){
url = URL + '?id=' + id
$.getJSON(url, function(data) {
captions = {'code':'Code','descr':{'content':'Description','attr': 'style="width: 800px"'}}
html_table = build_table(data, captions);
$('#anyDivId').html(html_table);
});
}
0 comments:
Post a Comment