表结构在我的应用程序中,有一种观点页面显示的属性名称表如标题和它的下面通过许多人充满价值。 像创建使用JQuery
Name Age salary
a 22 18912
b 23 89972
c 23 781273
我希望它像上面..
但我得到它作为
Name Age Salary
a 22 18912 b 23 89972 23 781273
我使用jQuery检索我的MySQL表,并从我的CakePHP的控制器代码将这些值查看它..
<head>
<script type="text/javascript">
$(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;
$("<th>"+i.label+"</th> ").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){
$("<td>"+i.value+"</td> ").appendTo("#body");
if(last==i.label){
// where i thought to create a new row for 2 row
}
return i.value;});
});
</script>
</head>
</body>
<table class="entries" cellspacing="0" cellpadding="3" border="1">
<tr id="headers"></tr>
<tr id="body"></tr>
</table>
</body>
如何使一个新行显示第二行和第三行的值在新行..请建议我.... 。