php代码
$this->ajaxReturn($list);
html代码
<script src="__JS__/template.js" type="text/javascript"></script>
返回值处
var msg = {'list': data.message, 'type': type};
var _html = template('recommandTemplate', msg);
$("#recommand").append(_html);
在列表显示处
<script id="recommandTemplate" type="text/html">
{{each list as value i}}
<tr class="text-center">
<td>{{value.customer_code}}</td>
<td>{{value.customer_name}}</td>
<td>{{value.cost_price}}</td>
<td>{{value.stock}}</td>
</tr>
{{/each}}
</script>