Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/383.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
jquery/javascript运行时变量和事件_Javascript_Jquery_Jquery Plugins - Fatal编程技术网

jquery/javascript运行时变量和事件

jquery/javascript运行时变量和事件,javascript,jquery,jquery-plugins,Javascript,Jquery,Jquery Plugins,我有一个jquery计时器,用户点击时就可以用ajax加载每条记录。 有一次它工作得很好,如果单击另一条记录,计时器再次加载来自first timer的ajax事件,按钮被替换为新计时器,那么如果我单击first timer,第二个计时器就会生效。 这段代码每次都在timer div中使用ajax加载,所以每次传递唯一id和jobprocessId时都会使用i var id = '<?php echo $jId;?>'; var jobprocessId='<?php e

我有一个jquery计时器,用户点击时就可以用ajax加载每条记录。 有一次它工作得很好,如果单击另一条记录,计时器再次加载来自first timer的ajax事件,按钮被替换为新计时器,那么如果我单击first timer,第二个计时器就会生效。 这段代码每次都在timer div中使用ajax加载,所以每次传递唯一id和jobprocessId时都会使用i

 var id = '<?php echo $jId;?>';
  var jobprocessId='<?php echo $jobprocessId; ?>';

jQuery('#pauseButton'+jobprocessId+id+'').toggle(function() { 

        jQuery('#pauseButton'+jobprocessId+id+'').hide(); 
        jQuery('#updateTimer'+jobprocessId+id+'').show();


    }, 
    function() { 
        jQuery('#pauseButton'+jobprocessId+id+'').hide(); 
        jQuery('#updateTimer'+jobprocessId+id+'').show();

    } 
); 
varid='';
var jobprocessId='';
jQuery('#pauseButton'+jobprocessId+id+'').toggle(function(){
jQuery('#pauseButton'+jobprocessId+id+'').hide();
jQuery('#updateTime'+jobprocessId+id+'').show();
}, 
函数(){
jQuery('#pauseButton'+jobprocessId+id+'').hide();
jQuery('#updateTime'+jobprocessId+id+'').show();
} 
); 
如果我需要用其他语言解释,请让我知道


我正在使用这个

我不确定我是否理解你的问题,但是我正在查看将错误类型的参数传递给切换函数的代码。 根据jquery站点,toggle接受参数

[ duration ], [ easing ], [ callback ]  where

durationA string or number determining how long the animation will run.
easingA string indicating which easing function to use for the transition.
callbackA function to call once the animation is complete.
您正在传递两个函数参数。
你能检查一下吗?

这些函数在按钮点击上运行良好,暂停/恢复和该页面上的圈数这是一个很大的代码,我将提取一些代码并尝试发布到那里。问题是:当调用ajax时,该代码在ajax div中每次都被调用,它将替换由相同代码在pauseButton上添加的旧事件,我使用的是唯一的数字(id)区分pauseButton,但它不使用它