<?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/"
		>
<channel>
	<title>Comments on: Query data from Django site with jQuery</title>
	<atom:link href="http://www.grenadepod.com/2009/11/13/query-data-from-django-site-with-jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.grenadepod.com/2009/11/13/query-data-from-django-site-with-jquery/</link>
	<description>Dispersing the Seeds</description>
	<lastBuildDate>Tue, 07 Feb 2012 23:07:54 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
	<item>
		<title>By: daimoneu</title>
		<link>http://www.grenadepod.com/2009/11/13/query-data-from-django-site-with-jquery/comment-page-1/#comment-2748</link>
		<dc:creator>daimoneu</dc:creator>
		<pubDate>Wed, 25 May 2011 15:33:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.grenadepod.com/?p=331#comment-2748</guid>
		<description>Instead of a batch, you could process the items one at a time like this:

&lt;code&gt;
var items;

function updateStatus(index) {
    if (index == items.size()) {return;}
    var item = items.eq(index);
    var attrId = item.attr(&quot;id&quot;);
    var address = attrId.replace(&#039;ip_&#039;, &#039;&#039;);
    address = address.replace(/_/g, &#039;.&#039;);
    $.get(&#039;/ping/&#039; + address,
        function(response) {
            item.html(response);
            $(&quot;ul&quot;).trigger(&#039;updated&#039;, [index]);
        }
    );
}

$(document).ready(function(){
    items = $(&quot;.address&quot;);
    $(&quot;ul&quot;).bind(&#039;updated&#039;,
        function(event, index) {
            updateStatus(index + 1);
        }
    );
    updateStatus(0);
});
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Instead of a batch, you could process the items one at a time like this:</p>
<p><code><br />
var items;</p>
<p>function updateStatus(index) {<br />
    if (index == items.size()) {return;}<br />
    var item = items.eq(index);<br />
    var attrId = item.attr("id");<br />
    var address = attrId.replace('ip_', '');<br />
    address = address.replace(/_/g, '.');<br />
    $.get('/ping/' + address,<br />
        function(response) {<br />
            item.html(response);<br />
            $("ul").trigger('updated', [index]);<br />
        }<br />
    );<br />
}</p>
<p>$(document).ready(function(){<br />
    items = $(".address");<br />
    $("ul").bind('updated',<br />
        function(event, index) {<br />
            updateStatus(index + 1);<br />
        }<br />
    );<br />
    updateStatus(0);<br />
});<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bitrober</title>
		<link>http://www.grenadepod.com/2009/11/13/query-data-from-django-site-with-jquery/comment-page-1/#comment-803</link>
		<dc:creator>bitrober</dc:creator>
		<pubDate>Thu, 22 Jul 2010 13:01:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.grenadepod.com/?p=331#comment-803</guid>
		<description>have a test</description>
		<content:encoded><![CDATA[<p>have a test</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bitrober</title>
		<link>http://www.grenadepod.com/2009/11/13/query-data-from-django-site-with-jquery/comment-page-1/#comment-802</link>
		<dc:creator>bitrober</dc:creator>
		<pubDate>Thu, 22 Jul 2010 13:00:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.grenadepod.com/?p=331#comment-802</guid>
		<description>df</description>
		<content:encoded><![CDATA[<p>df</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Forest Keniston</title>
		<link>http://www.grenadepod.com/2009/11/13/query-data-from-django-site-with-jquery/comment-page-1/#comment-663</link>
		<dc:creator>Forest Keniston</dc:creator>
		<pubDate>Thu, 11 Mar 2010 19:50:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.grenadepod.com/?p=331#comment-663</guid>
		<description>Just landed on this place via Google seek. I love it. This situation switch my percept and I am fixing the RSS feeds. Cheers.</description>
		<content:encoded><![CDATA[<p>Just landed on this place via Google seek. I love it. This situation switch my percept and I am fixing the RSS feeds. Cheers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Johnson</title>
		<link>http://www.grenadepod.com/2009/11/13/query-data-from-django-site-with-jquery/comment-page-1/#comment-658</link>
		<dc:creator>Mark Johnson</dc:creator>
		<pubDate>Sat, 06 Mar 2010 19:34:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.grenadepod.com/?p=331#comment-658</guid>
		<description>Thanks for your post. I am new at development and this will be a big help.</description>
		<content:encoded><![CDATA[<p>Thanks for your post. I am new at development and this will be a big help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pulegium</title>
		<link>http://www.grenadepod.com/2009/11/13/query-data-from-django-site-with-jquery/comment-page-1/#comment-14</link>
		<dc:creator>pulegium</dc:creator>
		<pubDate>Sun, 15 Nov 2009 21:07:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.grenadepod.com/?p=331#comment-14</guid>
		<description>Nizam, cheers for pointing out this plugin, I&#039;ll have a read a bout it. 
You mentioned that long lists might cause issues, is that because all requests will be processed in parallel? In which case using this plugin I could process them in streams, ie 10-20 at a time only, and then next batch, or something along those lines?</description>
		<content:encoded><![CDATA[<p>Nizam, cheers for pointing out this plugin, I&#8217;ll have a read a bout it.<br />
You mentioned that long lists might cause issues, is that because all requests will be processed in parallel? In which case using this plugin I could process them in streams, ie 10-20 at a time only, and then next batch, or something along those lines?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nizam</title>
		<link>http://www.grenadepod.com/2009/11/13/query-data-from-django-site-with-jquery/comment-page-1/#comment-13</link>
		<dc:creator>Nizam</dc:creator>
		<pubDate>Sun, 15 Nov 2009 01:18:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.grenadepod.com/?p=331#comment-13</guid>
		<description>Your approach is spot on. You may run into some issues after a while if your list of IP addresses becomes long. You may want to use the excellent &lt;a href=&quot;http://plugins.jquery.com/project/timers&quot; rel=&quot;nofollow&quot;&gt;jQuery Timers plugin&lt;/a&gt; to manage the ping operations via jQuery/AJAX. It&#039;s the closest thing to threading in JavaScript.</description>
		<content:encoded><![CDATA[<p>Your approach is spot on. You may run into some issues after a while if your list of IP addresses becomes long. You may want to use the excellent <a href="http://plugins.jquery.com/project/timers" rel="nofollow">jQuery Timers plugin</a> to manage the ping operations via jQuery/AJAX. It&#8217;s the closest thing to threading in JavaScript.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

