jq tounch id attar发生两次(jq tounch id attar occuring twice)
$('#news_details').bind('pageAnimationEnd', function (e, info) { // get the id of the calling href //alert('we are here'); var id = $(this).data('referrer')[0].id; //alert(id); $.get('http://localhost/school_app/admin/json/news_pagination.php?id=' + id, function (data) { // do something with the data //alert(data); $('#detail_news').append(data); //alert('we are here'); }); });
我正在查找这个id并将其传递到#news_details页面,它是成功的,但是当我喜欢页面时,脚本自动地由它自己发生。当我去#new_detail页面时,另一个id var,之前的数据仍然存在。
请帮帮我。$('#news_details').bind('pageAnimationEnd', function (e, info) { // get the id of the calling href //alert('we are here'); var id = $(this).data('referrer')[0].id; //alert(id); $.get('http://localhost/school_app/admin/json/news_pagination.php?id=' + id, function (data) { // do something with the data //alert(data); $('#detail_news').append(data); //alert('we are here'); }); });
I am geting this id and passing it to the #news_details page,it is successfully but when i like the page the script occurs atomatically by it's self.and when i go the the #new_detail page whit another id var the previous data is still there.
please help me.
原文:https://stackoverflow.com/questions/28737147
最满意答案
绑定文件句柄仅部分在perl中实现,不适用于EV。 一般情况下,绑定句柄不能与事件库一起使用:虽然某些特定情况可能有效,但在大多数使用绑定句柄的情况下,它们无法工作,因为基础文件描述符的准备就绪通知与准备就绪无关绑定句柄的通知。
如果你的目标只是在一个真实的文件描述符周围有一个东西包装器,那么一种方法就是复制IO :: Handle和/或FileHandle做的事情(非常难看,但是在perl中工作的唯一方法),或者将它们用作基类。 这不允许你做一些有趣的事情,比如挂钩读写,但是有可能挂钩它们会使它们与事件库不兼容。
另一种方法是实现perlio层(PerlIO :: via)。 根据我的经验,这个模块有点脆弱,但为您提供了所有选项。 同样,如果你引入缓冲或更有趣的东西,将文件描述符与实际的I / O分离,那么它就无法工作。
最后,如果要添加新类型的句柄,则可以创建新的观察者类型。 这可以像拥有一个函数my_handle_io_watcher一样简单,它可以处理你的句柄,检查准备情况并创建所需的低级观察者。
tied file handles are only partially implemented in perl, and don't work with EV. Tied handles cannot be made to work with an event library in general: While some specific cases might work, in most cases where tied handles are used, they can't work because the readiness notification of an underlying file descriptor doesn't relate to readiness notifications of the tied handle.
If your goal is to merely have a thing wrapper around a real file descriptor, then one way to do it is to copy what IO::Handle and/or FileHandle do (very ugly, but the only way that works in perl), or use them as base classes. This doesn't allow you to do interesting things such as hooking reads and writes, but chances are hooking them makes them incompatible with event libraries.
Another way is to implement a perlio layer (PerlIO::via). In my experience, this module is a bit fragile, but gives you all the options. Again, if you introduce buffering or more interesting things that decouple the file descriptor from the actual I/O, then it can't be made to work.
Lastly, if you want to add a new type of handle, then you can create a new watcher type. This can be as simple as having a function my_handle_io_watcher that takes your handle, checks for readiness and creates the kind of low-level watcher that is required.
相关问答
更多-
它也说 It returns true upon success, false otherwise. 这意味着你对chdir的调用失败了。 检查$! 对于发生了什么的线索变量。 由于没有发生致命的运行时错误,因此不必担心有关fchdir最后一段。 运行几个测试,我发现当FILEHANDLE引用一个目录时, chdir FILEHANDLE运行,但不会运行在普通文件上。 希望有助于: open(FH, "<", "/tmp/file"); # assume this file exists chd ...
-
假设你使用的是非常弱的加密: #! /usr/bin/perl print <
EOXML 使用open $fh, "-|", ...将创建一个连接到子进程的标准输出的管道: #! /usr/bin/perl use warnings; use strict; open my $decrypted, "-|", "./decrypt" or die "$0: open: $!"; while ... -
您只能在<>内使用简单的标量变量从文件句柄读取。 <$foo>起作用。 <$foo[0]>不从文件句柄读取; 它实际上等同于glob($foo[0]) 。 您必须使用readline内建函数,一个临时变量,或使用IO :: File和OO符号。 $text = readline($foo[0]); # or my $fh = $foo[0]; $text = <$fh>; # or $text = $foo[0]->getline; # If using IO::File 如果你没有从循环中的数组中删 ...
-
绑定文件句柄仅部分在perl中实现,不适用于EV。 一般情况下,绑定句柄不能与事件库一起使用:虽然某些特定情况可能有效,但在大多数使用绑定句柄的情况下,它们无法工作,因为基础文件描述符的准备就绪通知与准备就绪无关绑定句柄的通知。 如果你的目标只是在一个真实的文件描述符周围有一个东西包装器,那么一种方法就是复制IO :: Handle和/或FileHandle做的事情(非常难看,但是在perl中工作的唯一方法),或者将它们用作基类。 这不允许你做一些有趣的事情,比如挂钩读写,但是有可能挂钩它们会使它们与事件库 ...
-
Perl有许多隐含的行为,比其他大多数语言都多。 Perl的座右铭是“有更多的事情需要去做”,而且由于有太多隐含的行为,通常有多种方式来表达完全相同的东西。 /foo/而不是$_ =~ m/foo/ $x = shift而不是$x = shift @_ while (defined($_=
))而不是while(<>) 等等 使用哪种表达方式很大程度上取决于您当地的编码标准和个人偏好。 更明确的表达方式会提醒读者引擎盖下的真实情况。 这可能会也可能不会提高代码的可读性 - 这取决于观众的知识水平以 ... -
似乎在写入文件句柄后,一个裸露的打印语句将打印到该文件句柄。 不,它表示它将打印到最后选择的句柄 ,而不是您打印的最后一个句柄 。 它会指示您阅读此页面以了解如何执行此操作。 open (FILE, '>', 'PrintTest.txt') or die $!; print FILE "Hello world!\n"; select(FILE); <----- Missing print "Hello.... hello? hello world! ...
-
我可能会误解(我不是Windows程序员),但我认为文件在Win32中打开时不能被删除或替换,或者至少在默认情况下是不可能的。 I may be mistaken (I'm not a Windows programmer), but I thought files can't be deleted or replaced when they are opened in Win32, or at least by default it isn't possible.
-
在使用NEW打开相同文件之前,您似乎忘了关闭MAKE_NEW_FILE。 其他一些要点: &function语法大部分已被弃用,因为它绕过了原型检查。 我相信你正在使用use warnings; 并use strict; 。 我注意到你打开了两个参数,打开了三个参数。 尽管两者都是合法的,但它们具有不同的思维模式,这使得将它们与程序员混淆使用。 我会坚持打开三个论点,因为我认为它更容易理解(除非你正在打码高尔夫) It looks like you forgot to close MAKE_NEW_FILE ...
-
第二种形式是允许的,因为它是原始形式。 您以前只能通过包含它们的glob的名称来引用文件句柄。 现在,文件句柄可以是一个glob的名称,也可以是一个包含在文件句柄对象中的glob的引用,也可以是对文件句柄对象的引用。 后两者可以以标量存储(因此可以在词汇范围内)。 您应该避免在新代码中使用globs作为文件句柄。 The second form is allowed because it is the original one. You used to only be able to refer to fi ...
-
perl文件句柄while while循环不会在没有其他行的情况下终止(perl filehandle while loop does not terminate on no further lines)[2022-07-28]
好的,这里问题的根源是一段while () {循环将阻止文件句柄是否打开但没有数据要读取。 所以很可能/usr/local/bin/stream继续管道数据直到被杀 - 所以你的读取阻塞了。 简单的解决方案是使用类似IO::Select东西,其中包含can_read作为选项: use IO::Select; open ( my $stream, '-|', '/usr/local/bin/stream' ) or die $!; #register this filehandl ...