When performing a modification operation, the modification operation can be completed in the background (database data can be modified). How to click Modify to display the data and then modify it?
Kay
Kay 2021-07-21 16:14:45
0
3
1078

Modification link of index page

<div><a href="{:url('admin/broadcast/update',['id'=>$v['id'] ])}">Modify</a></div>

jquery

$(function(){

$('#upda ').click(function(id){

          var id = $(this).attr('id'); 'Post',

Url: "{: url ('admin/" broadcast/update')} ",

Data: $ ('#form'). Serialize (),

                        dataType:'json',

                                                                                                                                                              alert("success");

                                  

##                                                                                                                                                          # public function update(){

$id=$this->request->get('id');

print_r($id);

if($this->request->isPost()){

          $post=$this->request->post();

                                                         table('tplay_broadcast')-> where('id',$id)->update($post); 'tplay_broadcast')->where('id',$id)->find();

            $this->assign('data',$data);

return $this->fetch();

}

}

Kay
Kay

reply all(2)
Kay

Solved because after assigning the value to the front end, the <textarea value={data.name}> used by the front end should be assigned the value here</textarea>, and the value in the angle brackets is what the back end sees

Peter_Zhu

I don’t understand your question, can you provide a picture?

  • reply The code can complete the database modification operation, but after clicking modification, an empty modification form is submitted. Is it a value-passing error submitted by the a link, or is there something missing in the jquery link writing?
    Kay author 2021-07-23 11:28:55
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template