search

Home  >  Q&A  >  body text

The elastic layer+$.post cannot obtain the data. Please help me!


//View code

<a href="javascript:;" title="Modify" onclick="update_column({$vo.column_id})" ><span class="glyphicon glyphicon-pencil"></span></a>


//js with code//modify column

function update_column(id){
$.post("{:url('admin/update_column')}",{id:id});
layer.open({
type: 2 //Page Layer type
,area: ['500px', '220px']
,title: 'User added'
,shade: 0.6 //Mask transparency
,maxmin: true //Allow full screen Minimize
,anim: 1 //0-6 animation form, -1 does not open
,content: 'update_column.html'
});
}

/ /Controller with code

public function update_column(Request $request){
$date=$request->param('id');
$list=Book_column:: get($date);
$this->view->assign('list',$list);
return $this->view->fetch();
}


//Pop-up window

<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">Column name</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">Modify column</button>
; </div>
</div>
</form>
</div>
</div>

王岁洋王岁洋2574 days ago941

reply all(1)I'll reply

  • lmaster

    lmaster2017-10-27 11:04:49

    $.post("{:url('admin/update_column')}",{id:id});

    $.post({

              url: "url( 'admin/update_column')",

    data:{id:id},

    success:function(data){

    console.log (data);

    ##                                                                                                                  , title: 'User added'

    ,shade: 0.6 //Mask transparency
    ,maxmin: true //Allow full screen minimization
    ,anim: 1 //0- 6 animation mode, -1 is not enabled
                  , content: 'update_column.html'
                                                                                                                                                                                           Download the api of jquery-ajax

    Understand the f12 of chorme and debug

    reply
    1
  • Cancelreply