html页面
{js:jquery}
<td title="{$item['mobile']}" class="mob"> <span class="mobile">{$item['mobile']}</span> </td>
<script> $(function(){ $(document).on("click",".mobile",function(){ //alert("qwe"); var mobile = $(this).html(); //alert(mobile); $(this).parent().html('<input type="text" name="mobiles" value="'+mobile+'"/>'); }); $(document).on("blur","input[name='mobiles']",function(){ var mm=$(this).val(); var sid = $(this).parents("tr").attr("sid"); //alert(sid); $.getJSON("{url:/member/ajax_seller_mobile}",{"id":sid,"mobile":mm}); $(this).parent().html("<span class='mobile'>"+mm+"</span>"); }) }) </script> member控制器页面public function ajax_seller_mobile() { $id = IFilter::act(IReq::get('id')); $lock = IFilter::act(IReq::get('mobile')); $sellerObj = new IModel('seller'); $sellerObj->setData(array('mobile' => $lock)); $sellerObj->update("id = ".$id); }