//视图代码
<a href="javascript:;" title="修改" onclick="update_column({$vo.column_id})"><span class="glyphicon glyphicon-pencil"></span></a>
//js带码//修改栏目
function update_column(id){
$.post("{:url('admin/update_column')}",{id:id});
layer.open({
type: 2 //Page层类型
,area: ['500px', '220px']
,title: '用户添加'
,shade: 0.6 //遮罩透明度
,maxmin: true //允许全屏最小化
,anim: 1 //0-6的动画形式,-1不开启
,content: 'update_column.html'
});
}
//控制器带码
public function update_column(Request $request){
$date=$request->param('id');
$list=Book_column::get($date);
$this->view->assign('list',$list);
return $this->view->fetch();
}
//弹窗
<div class="panel panel-default">
<div class="panel-body">
<form class="form-horizontal" role="form">
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">栏目名</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="column_name" id="firstname"
placeholder="{$list.column_name}">
</div>
</div>
<input type="hidden" name="column_id" value="{$list.column_id}">
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="button" id="update" class="btn btn-default">修改栏目</button>
</div>
</div>
</form>
</div>
</div>
$.post("{:url('admin/update_column')}",{id:id});
$.post({
url:"url('admin/update_column')",
data:{id:id},
success:function(data){
console.log(data);
layer.open({
type: 2 //Page层类型
,area: ['500px', '220px']
,title: '用户添加'
,shade: 0.6 //遮罩透明度
,maxmin: true //允许全屏最小化
,anim: 1 //0-6的动画形式,-1不开启
,content: 'update_column.html'
});
},
});
你先学习下json,在学习下jquery-ajax的api
在了解下chorme的f12,调试