<table width="80%" border="0" align="center" cellpadding="3" cellspacing="1" class="table" style="margin-right: 50px;"> <tr> <td class="bg_tr" align="center"><input type="checkbox">[<a href="javascript:void(0)">全选</a>]</td> <td class="bg_tr" align="center">配件名</td> <td class="bg_tr" align="center">单价</td> <td class="bg_tr" align="center">数量</td> </tr> <?php foreach($trims as $trim): ?> <tr> <td class="td_bg" align="center"><input type="checkbox">[<a href="javascript:void(0)" onclick="opList($(this),<?= $trim->store_room_id ?>,<?= $fix_id ?>,0)">领取</a>]</td> <td class="td_bg" align="center"><?= $trim->storeRoom->name ?></td> <td class="td_bg" align="center"><?= $trim->storeRoom->price ?>元</td> <td class="td_bg" align="center"><input class="num" type="number" size="1" value="1" min="1" max="100"></td> </tr> <?php endforeach; ?> </table> <script> function opList(obj,fk_id,fix_id,item_id){ var num = obj.parents('tr').find('.num').val(); $.post('/fix-car-item/ajax-get-item',{num:num,fk_id:fk_id,item_id:item_id,fix_id:fix_id,type:1},function(data){ alert(data.msg); },'json'); } </script>