Dan, It works better, but stills to start twice in 50% of cases (if you have better idea to start events on ajax-generated content without LiveQuery, I'm OK :) )
2007/10/31, Dan G. Switzer, II <[EMAIL PROTECTED]>: > > > Samy, > > >Hi all > >I'm french PHP developer (part of the Spongestats project - > >http://spongestats.sourceforge.net) and a newbie user of jQuery. > > > >I recently used jQuery to implement an ajax-powered refresh system for my > >last visitors (as shown on http://fetardalyon.sytes.net/Spongestats/v3/). > > > >But, I encoutered the following bug : setInterval is used to call an > other > >page, every X seconds, and retrieve new visitors by ajax call. And, each > >ajax-call is executed twice :( > > > >By removing LiveQuery plugin, I can say this plugin is the source of my > >bug, but I need it to start events on ajax-generated content. > > > >So, can anybody help me to resolve it? > > My guess is it's because you're defining that <script> block that sets up > the setInterval() in the <body> of the page. > > Try moving this block of code inbetween the <head> tags: > > <script type="text/javascript"> > var refresh_details=function() > { > if ($(".plus_details").get(0)) > { > var top_id=$(".plus_details").get(0).id.split('-')[1]; > } > else > { > var top_id=0; > > } > //console.log("essai"); > > > $.get("includes/inc.home.php",{top_id:top_id},function(txt){$(".ligne-pair:f > irst").after(txt);$(".refresh:first").slideDown("slow");}); > > } > $(function() {setInterval(refresh_details, 1000*2); }); > </script> > > I've not really looked at the LiveQuery code, but my guess is it's forcing > the browser evaluating that script block twice. > > -Dan > >