?Briella 2014-07-22 09:47 采纳率: 0%
浏览 21

刷新div面板

I am trying to delete a button on click from a layout itself . but unable to do it so far . I am new to ajax and jQuery . I have a div on web page showing pending actions in the form of buttons now I want to remove each button when user clicks on it. this web page is auto refreshed in every 1 minute and all these pending actions are stored in a session variable .

now I am not getting a way to send this button id to another php script so that it can delete it from session array.

I tried following ..

     <script type='text/javascript'src='http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'></script> 
    function HideButton(butId)
      {
        $('#'+butId).hide();
        deleteButton(butId);

      }
    </script>


 <script>
 function deleteButton(id) {
     $.ajax({
      url: "delete_button.php",
      type: "POST",
      data: "id=" + id,
      success: function(response) {// Response handler}
   }); 
 }
 </script>

 <?php  // here is my php code ..

 //displaying button as follows in a loop 
 echo "<br><button type='button' id='".$id."' onclick=javascript:HideButton('".$id."') >".$pendingAction[$id]." </button>";

did not found any success yet.

  • 写回答

3条回答 默认 最新

  • weixin_33734785 2014-07-22 09:50
    关注

    use the jQuery remove

    DOM:

    <div class="container">
    <div class="hello">Hello</div>
    <div class="goodbye">Goodbye</div>
    </div>
    

    jQuery:

    $( ".hello" ).remove();
    

    Output:

    <div class="container">
      <div class="goodbye">Goodbye</div>
    </div>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题