search

Home  >  Q&A  >  body text

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?

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();

}

}

KayKay1279 days ago1101

reply all(3)I'll reply

  • Kay

    Kay2021-07-30 09:37:15

    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

    reply
    0
  • 猪老湿

    猪老湿2021-07-23 11:22:51

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

    reply
    0
  • Kay

    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 · 2021-07-23 11:28:55
  • Cancelreply