简体   繁体   English

使用弹出模式进行编辑

[英]Editing using Pop-up modal

I've some problems with my Edit function for editing my groups table. 我的用于编辑分组表的“编辑”功能存在一些问题。 the fields are "group_id(primary key), cat_id(foreign key), group_name" I used the group_id as the identifier of which group information I should edit 这些字段是"group_id(primary key), cat_id(foreign key), group_name"我使用group_id作为应编辑的组信息的标识符

This is my Edit button 这是我的编辑按钮

a href="#" data-toggle="modal" data-target="#myModal3" class="btnedit">Edit</a

When i clink the Edit Button, this modal will pop up 当我点击“编辑按钮”时,此模式将会弹出

<div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"></div>

I added an hidden input type to hold the group_id 我添加了一个隐藏的输入类型来保存group_id

" id="editID"> “ id =” editID“>

I used this javascript to get the group_id value. 我使用此JavaScript来获取group_id值。

<script>

  $('.btnedit').click(function(){

    var url = '<?php echo DEFAULT_URL."group/edit_group/";?>';

    $.post(url,{'group_id':$('#editID').val()},function(res){

    if(res)

      {

      }

    });

  });

</script>

My question now is how will I apply the vallue that I got from my javascript into the modal to edit the details from the group_id that I seected? 我现在的问题是,如何将我从javascript中获得的价值应用到模式中,以从我选择的group_id中编辑详细信息?

<script>

  $('.btnedit').click(function(){

    var url = '<?php echo DEFAULT_URL."group/edit_group/";?>';

    $.post(url,{'group_id':$('#editID').val()},function(res){

    if(res)

      {
         $('#myModal2').html('<div><p>'+res.value+'</p></div>');
      }

    });

  });

</script>

??? ???

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM