如何使用jQuery打开一个新页面


How to open a new page with 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();   
     });
   }
 });

目前尚不清楚您要发送的确切属性,但看起来它是元素的 id。如果是这样,请在此处进行更正:

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

应该是

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

因此,您将发送元素的 id 属性。

如果这仍然不起作用,则删除脚本的路径可能不正确...Chrome Dev Tools或Firebug会告诉你这一点。