ajax.php public function dailido(){ $zhi=I('post.value'); $id=I('post.id'); $users=M('users'); if($users-where(array('id'=$id))-save(array('rank'=$zhi))){ echo '操作成功'; } }function delall(){$('#form1').attr('action','{:U('delall')}')
public function dailido(){ $zhi=I('post.value'); $id=I('post.id'); $users=M('users'); if($users->where(array('id'=>$id))->save(array('rank'=>$zhi))){ echo '操作成功'; } } function delall(){ $('#form1').attr('action','<{:U('delall')}>'); $('#form1').submit(); } $(function(){ $("select[name='daili']").change(function() { var zhi=$(this).val(); var id=$(this).parent('td').parent('tr').children('td:eq(0)').children('input').val(); $.ajax({ type: "POST", datatype:'text', url: "<{:U('user/dailido')}>", data:{value:zhi,id:id}, success: function(data){ if(data){ alert(data); }else{ alert('修改失败,请重试'); } }, }); }); })