Note that there are some explanatory texts on larger screens.

plurals
  1. POCreating a table structure using JQuery
    text
    copied!<p>In my application, there is a view page to show the table of Attributes name as the header and its value filled by many people below. Like</p> <pre><code>Name Age salary a 22 18912 b 23 89972 c 23 781273 </code></pre> <p>i want it like above ..<br> But i am getting it as </p> <pre><code>Name Age Salary a 22 18912 b 23 89972 23 781273 </code></pre> <p>I am using JQuery to retrieve these values from my Mysql table and from my Cakephp controller code to view it ..</p> <pre><code>&lt;head&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ var ht = $.ajax({ type: "GET", url: "http://localhost/FormBuilder/index.php/admins/viewEntries/"+formid, async: false }).responseText; var myObject = eval('(' + ht + ')'); var data = myObject;var last; $.map(data.labels, function(i){ last=i.label; $("&lt;th&gt;"+i.label+"&lt;/th&gt; ").appendTo("#headers"); return i.label;}); var htm = $.ajax({ type: "GET", url: "http://localhost/FormBuilder/index.php/admins/viewResults/"+formid, async: false }).responseText; var myObject1 = eval('(' + htm + ')'); var data1 = myObject1; $.map(data1.values, function(i){ $("&lt;td&gt;"+i.value+"&lt;/td&gt; ").appendTo("#body"); if(last==i.label){ // where i thought to create a new row for 2 row } return i.value;}); }); &lt;/script&gt; &lt;/head&gt; &lt;/body&gt; &lt;table class="entries" cellspacing="0" cellpadding="3" border="1"&gt; &lt;tr id="headers"&gt;&lt;/tr&gt; &lt;tr id="body"&gt;&lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; </code></pre> <p>How to make a new row to display the 2nd and 3rd row values in the new row..Please suggest me.....</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload