English 中文(简体)
jquery去除 but子,可以从数据库中删除行文。
原标题:jquery remove button can t delete row from database

我在一份清单中,每个列载一个带子,在被点击时予以去除,并从我的数据库中抽取一些箱子数据。 I ve创建了一种双管齐——监视——比兹_id,这是每个箱子独有的。 用美元标出的器件向服务器一侧(php)打字,删除表流。

但是,这本书没有作用。 如果放弃功能,Im能够拆除这些箱子,但用植被指挥,这些箱子再也无法拆除。 以下是这些法典:

    foreach($biz_watchlist as $biz_watchlist1){
         echo  <li class="biz_watch" id="biz_watch .$biz_watch_id. "> ;
         echo  <table style="width:100%"> ;
         echo  <td style="width:50%"> ;
         echo $biz_watch_details[ 5 ];
         echo   | <a class="remove_watch" id="remove_watch .$biz_watch_id. ">remove</a> ;
         echo  </td> ;
         echo  <td> ;
         echo  <span style="float:right"> .$biz_watch_details[ 19 ]. </span> ;
         echo  </td> ;
         echo  </table> ;
         echo  </li> ;
    }

    <script type="text/javascript">
     $(document).ready(function(){
        $( .remove_watch ).click(function(){
            var li = $(this).closest( li.biz_watch );
            var action =  ../delete_watchlist.php ;
            var data = { id:13};
               $.post(action, data, function(){
                 li.fadeOut( slow , function() {
                     li.remove();
                 });
               });
        });
    });
    </script>

My Server side Script

      <?php
        $id = $_POST["id"];

        $query = "DELETE FROM dz0yn_biz_watchlist WHERE biz_id = $id";
        $delete_watch_row = mysql_query($query);
      ?>
最佳回答
  1. Prefixing a relative directory (..) with a / turns it into an absolute path that references itself. That s kinda pointless. the first / should be removed ( ../delete_watchlist.php ).

  2. 页: 1 你们试图把太多的东西放在混淆问题的一线。

这应当完成你之后的工作,假设你的服务器边稿成功。

$(document).ready(function(){
    $( .remove_watch ).click(function(){
        var li = $(this).closest( li.biz_watch );
        var action =  ../delete_watchlist.php ;
        var data = { id: li.attr( id ).substr(9) };
        $.post(action, data, function(){
            li.fadeOut( slow , function() {
                li.remove();
            });
        });
    });
});
问题回答

http://api.jquery.com/jQuery.post/“rel=“nofollow”>post( over get()

$.post( /.../delete_watchlist.php , {id: $(this).closest( .biz_watch ).attr( id )},function(){
    $(this).closest( .biz_watch ).fadeOut("slow");
});

http://www.jquery4u.com/ajax/key-differences-post/“rel=“nofollow”>jquery4u blog 数额之高:

如果处理一种形式是多余的(即对世界状况没有持久可见的影响),那么形式方法应该是全球教育。 许多数据库的搜索没有明显的副作用,并且提供了理想的查询表格。

如果与处理表格有关的服务具有副作用(例如,修改数据库或订阅服务),则该方法应为《名册》。

Edit:

你正在积极创建桌子,这意味着在桌子完全建立之前,你已经站起来了;因此,你很可能不会在座各位上点击。

您需要利用on()活动,将事件应用于以后可能制造的物体。

$(document).ready(function(){
    $( .remove_watch ).on("click", function(){
        $.get( /.../delete_watchlist.php , {id:  $(this).closest( .biz_watch ).attr( id )},function(){
            $(this).closest( .biz_watch ).fadeOut("slow");
        });
    });
});

http://www.ohchr.org。

最后一次审判:P。 由于你只需要12个而不是整个监听器,因此,你可以代替你把双子——监视从你发往服务器。

$(this).closest( .biz_watch ).attr( id ).replace("biz_watch", "");




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签