How to use JavaScript, Ajax or jQuery to display array data in table -
Right now I'm getting data like this which works fine, but I want to auto show it in a table . I have a button that has been clicked and the result should be displayed in the table or a table should be made and it will be ok to perform in any way.
$ result = array (); While ($ line = mysql_fetch_assoc ($ resolution)) {$ result [$ i] [0] = $ line ['fname']; $ Result [$ i] [1] = $ line ['lname']; $ Result [$ i] [2] = $ line ['membership']; } Return result; Any help would be great
of a data structure Seeing this: [{fname: "John", lname: "do", membershipid: "1234"}]
Data should work for
function createTable (data array) {var table = document.createElement ('table'); Top tablerows = dataArray.map (function (DataRow) {var tablerow = document.createElement ('tr'); for (value in DataRow) {var cell = document.createElement ('TD'); cell.innerText = DataRow [Price]; Tablaro Amped Child (cell);} Return tabularo;}); For (var i = 0; i then
var table = createtable (data array); Document.getElementById ('Whatever Dom Node'). Appleband (table);
Comments
Post a Comment