Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/271.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何使用jQuery打开新页面_Php_Jquery - Fatal编程技术网

Php 如何使用jQuery打开新页面

Php 如何使用jQuery打开新页面,php,jquery,Php,Jquery,不清楚您想要发送什么属性,但它看起来像是元素的id。如果是,下面是更正的地方: //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

不清楚您想要发送什么属性,但它看起来像是元素的id。如果是,下面是更正的地方:

//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();   
     });
   }
 });
应该是

jQuery.get('delete.php', { id:this.id });
因此,您将发送元素的id属性


如果仍然不起作用,您可能有不正确的删除脚本路径…chrome开发工具或firebug会告诉您这一点。

您是说没有请求delete.php,还是没有将id参数发送到delete.php?我的第一个建议是使用带有控制台的浏览器(Firefox&firebug或chrome)并插入一行
console.log(“ID=“+this.ID”)
jQuery.get之前的行('delete.php'…。这将允许您查看提取了哪些ID值并将其发送到delete.php脚本中。@JeremyWeir delete.php没有被请求,但可能是因为没有发送ID参数,对吧?可能是JS错误杀死了它。delete.php是否与请求它的页面位于同一目录中(我问你,因为你有一个相对路径)?@Jeremy如果路径不正确,你可以在不调用jQuery对象的情况下访问id。(事实上,使用
this.id
比使用
jQuery(this.attr('id')
稍微快一点).所以这是一个不正确的解决方案。--看到了吗?我忘记了。我应该在回答的第二部分多加一点:)
jQuery.get('delete.php', { id:jQuery(this).attr('id') });