简体   繁体   中英

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();   
     });
   }
 });

It's not clear exactly what attribute you want to send, but it looks like it's the element's id. If so, here's where the correction is:

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

should be

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

So you'll send the id attribute of the element.

If that's still not working, you may have the incorrect path of the delete script...chrome dev tools or firebug would tell you this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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