如何用jQuery打开一个新页面

时间:2012-06-21 00:41:22

标签: php jquery

//activate selected row in table
jQuery('.activatebutton').click(function(){
  var tb = jQuery(this).attr('title');
  //initialize to false as no selected row
  var sel = false;
  //get each checkbox in a table
  var ch = jQuery('#'+tb).find('tbody input[type=checkbox]');

  //check if there is/are selected row in table
  ch.each(function(){
    if(jQuery(this).is(':checked')) {
      //set to true if there is/are selected row
      sel = true;
     jQuery(this).parents('tr').fadeOut(function(){
       /*
       THIS IS THE LINE THAT IS NOT WORKING BELOW!!!! I want to send VALUE ID to delete.php
       */
       jQuery.get('delete.php', { id:this.id });
       //remove row when animation is finished
       jQuery(this).remove();   
     });
   }
 });

1 个答案:

答案 0 :(得分:1)

目前尚不清楚你想要发送什么属性,但它看起来像是元素的id。如果是这样,这里是更正的地方:

jQuery.get('delete.php', { id:this.id });

应该是

jQuery.get('delete.php', { id:jQuery(this).attr('id') });

所以你将发送元素的id属性。

如果仍然无效,您可能会有错误的删除脚本路径... chrome dev工具或firebug会告诉您。

相关问题