示例:
ajax返回的数组进行遍历
$.ajax({ type:"POST", url:"<?php echo base_url(); ?>public_res/get_looked_comodity", dataType:"json", success:function(arr){ $.each(arr, function(key, val) { $("#car_list").append('<li class="hover"><a class="shopImg" href=""><img src='+val['image1']+' alt='+val['name']+'/></a><h3><a title='+val['name']+' href="">'+val['name']+'</a></h3><p><em>¥'+val['price']+'</em><!--<a class="delete" href="">删除</a> --></p></li>'); }); } })