<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
	>
<channel>
	<title>Comments on: JQuery PeriodicalUpdater (AJAX long polling/server polling)</title>
	<atom:link href="http://enfranchisedmind.com/blog/posts/jquery-periodicalupdater-ajax-polling/feed/" rel="self" type="application/rss+xml" />
	<link>http://enfranchisedmind.com/blog/posts/jquery-periodicalupdater-ajax-polling/</link>
	<description>programming, politics, &#38; other religious issues</description>
	<lastBuildDate>Mon, 15 Mar 2010 00:31:40 +0000</lastBuildDate>
	
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: alistairh</title>
		<link>http://enfranchisedmind.com/blog/posts/jquery-periodicalupdater-ajax-polling/#comment-37181</link>
		<dc:creator>alistairh</dc:creator>
		<pubDate>Wed, 27 Jan 2010 14:46:06 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=1450#comment-37181</guid>
		<description>Another issue I ran into with:

if(ajaxSettings.dataType == &#039;json&#039;) {
                remoteData = JSON.parse(remoteData);
}

is that it fails in Firefox &lt;3.1 as it assumes native JSON. I looked at the way jQuery handle this in their own ajax function, and implemented it the same way (albeit with unsafe evaling of the JSON in the browser). The resulting modification is below: 

if(ajaxSettings.dataType == &#039;json&#039;) {
      remoteData = window.JSON &amp;&amp; window.JSON.parse ?
				window.JSON.parse( remoteData ) : (new Function(&quot;return &quot; + remoteData))();
}</description>
		<content:encoded><![CDATA[<p>Another issue I ran into with:</p>
<p>if(ajaxSettings.dataType == &#8216;json&#8217;) {<br />
                remoteData = JSON.parse(remoteData);<br />
}</p>
<p>is that it fails in Firefox &lt;3.1 as it assumes native JSON. I looked at the way jQuery handle this in their own ajax function, and implemented it the same way (albeit with unsafe evaling of the JSON in the browser). The resulting modification is below: </p>
<p>if(ajaxSettings.dataType == &#039;json&#039;) {<br />
      remoteData = window.JSON &amp;&amp; window.JSON.parse ?<br />
				window.JSON.parse( remoteData ) : (new Function(&quot;return &quot; + remoteData))();<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Fischer</title>
		<link>http://enfranchisedmind.com/blog/posts/jquery-periodicalupdater-ajax-polling/#comment-37176</link>
		<dc:creator>Robert Fischer</dc:creator>
		<pubDate>Thu, 21 Jan 2010 01:14:32 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=1450#comment-37176</guid>
		<description>Thanks for the feedback.  I&#039;m not working on the project right not, but if you fork, do the updates in GitHub, and send me a pull request, I&#039;d be happy to pull in the new code.

The trimming was required due to slop in the way xhr was implemented on some platform (trying to remember which).  How trailing whitespace is dealt with is basically woefully inconsistent, so I trimmed for consistency.</description>
		<content:encoded><![CDATA[<p>Thanks for the feedback.  I&#8217;m not working on the project right not, but if you fork, do the updates in GitHub, and send me a pull request, I&#8217;d be happy to pull in the new code.</p>
<p>The trimming was required due to slop in the way xhr was implemented on some platform (trying to remember which).  How trailing whitespace is dealt with is basically woefully inconsistent, so I trimmed for consistency.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mike</title>
		<link>http://enfranchisedmind.com/blog/posts/jquery-periodicalupdater-ajax-polling/#comment-37174</link>
		<dc:creator>mike</dc:creator>
		<pubDate>Wed, 20 Jan 2010 20:40:40 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=1450#comment-37174</guid>
		<description>Hi Robert I have some feedback.

I think this version of boostPeriod() is much clearer:
 
var boostPeriod = function() { 
  if (settings.multiplier &gt; 1)
    timerInterval = Math.max(timerInterval * settings.multiplier, settings.maxTimeout);
};

Constructing an optimized version of a function can be a useful technique, but here saving a property lookup and comparison once every 1 to 8 seconds is way overkill.

===

I&#039;m curious, is it necessary to have success and error callbacks if you already have a complete callback registered? Complete should be called in either case, and is already checking the success status?

===

trimming each xhr and checking for &#039;STOP_AJAX_CALLS&#039; seems quite app specific, it should at the minimum be a setting thats turned off by default, and documented.


Mike</description>
		<content:encoded><![CDATA[<p>Hi Robert I have some feedback.</p>
<p>I think this version of boostPeriod() is much clearer:</p>
<p>var boostPeriod = function() {<br />
  if (settings.multiplier &gt; 1)<br />
    timerInterval = Math.max(timerInterval * settings.multiplier, settings.maxTimeout);<br />
};</p>
<p>Constructing an optimized version of a function can be a useful technique, but here saving a property lookup and comparison once every 1 to 8 seconds is way overkill.</p>
<p>===</p>
<p>I&#8217;m curious, is it necessary to have success and error callbacks if you already have a complete callback registered? Complete should be called in either case, and is already checking the success status?</p>
<p>===</p>
<p>trimming each xhr and checking for &#8216;STOP_AJAX_CALLS&#8217; seems quite app specific, it should at the minimum be a setting thats turned off by default, and documented.</p>
<p>Mike</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Fischer</title>
		<link>http://enfranchisedmind.com/blog/posts/jquery-periodicalupdater-ajax-polling/#comment-37167</link>
		<dc:creator>Robert Fischer</dc:creator>
		<pubDate>Fri, 15 Jan 2010 20:19:04 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=1450#comment-37167</guid>
		<description>My recommendation for a .stop() would be to implement the ability to change the timeout (or other options) during runs, a la the &quot;Can Has Biz?&quot; solution.  

Once you&#039;ve got that, .stop() consists of cranking up the time to wait to something ridiculously high or setting a &quot;stop&quot; flag.</description>
		<content:encoded><![CDATA[<p>My recommendation for a .stop() would be to implement the ability to change the timeout (or other options) during runs, a la the &#8220;Can Has Biz?&#8221; solution.  </p>
<p>Once you&#8217;ve got that, .stop() consists of cranking up the time to wait to something ridiculously high or setting a &#8220;stop&#8221; flag.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: alistairh</title>
		<link>http://enfranchisedmind.com/blog/posts/jquery-periodicalupdater-ajax-polling/#comment-37166</link>
		<dc:creator>alistairh</dc:creator>
		<pubDate>Fri, 15 Jan 2010 19:41:24 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=1450#comment-37166</guid>
		<description>Very useful script - thank you! I had been hunting for a jQuery equivalent to Prototype&#039;s periodical executor for a while. Finally found a solution rather than unresolved questions in forums. I may have a bash at creating a .stop() as that would be useful.</description>
		<content:encoded><![CDATA[<p>Very useful script &#8211; thank you! I had been hunting for a jQuery equivalent to Prototype&#8217;s periodical executor for a while. Finally found a solution rather than unresolved questions in forums. I may have a bash at creating a .stop() as that would be useful.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
