<?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: Real-time &#8220;AJAX&#8221; JavaScript Progress Bar</title>
	<atom:link href="http://blog.perplexedlabs.com/2008/11/07/real-time-ajax-javascript-progress-bar/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.perplexedlabs.com/2008/11/07/real-time-ajax-javascript-progress-bar/</link>
	<description>web development war stories from the frontlines to the backend</description>
	<lastBuildDate>Fri, 05 Mar 2010 05:20:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Resources for PHP Webmail &#171; David Woodfield</title>
		<link>http://blog.perplexedlabs.com/2008/11/07/real-time-ajax-javascript-progress-bar/comment-page-1/#comment-2714</link>
		<dc:creator>Resources for PHP Webmail &#171; David Woodfield</dc:creator>
		<pubDate>Tue, 24 Nov 2009 16:58:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.perplexedlabs.com/?p=43#comment-2714</guid>
		<description>[...] http://blog.perplexedlabs.com/2008/11/07/real-time-ajax-javascript-progress-bar/ [...]</description>
		<content:encoded><![CDATA[<p>[...] <a href="http://blog.perplexedlabs.com/2008/11/07/real-time-ajax-javascript-progress-bar/" rel="nofollow">http://blog.perplexedlabs.com/2008/11/07/real-time-ajax-javascript-progress-bar/</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt</title>
		<link>http://blog.perplexedlabs.com/2008/11/07/real-time-ajax-javascript-progress-bar/comment-page-1/#comment-2378</link>
		<dc:creator>Matt</dc:creator>
		<pubDate>Wed, 29 Apr 2009 15:57:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.perplexedlabs.com/?p=43#comment-2378</guid>
		<description>@hoa

Try &#039;flush();&#039; not ob-flush.  Also make sure you don&#039;t have any output buffering enabled before entering the loop.

Finally, add a small sleep delay to the loop &#039;usleep(25000);&#039;</description>
		<content:encoded><![CDATA[<p>@hoa</p>
<p>Try &#8216;flush();&#8217; not ob-flush.  Also make sure you don&#8217;t have any output buffering enabled before entering the loop.</p>
<p>Finally, add a small sleep delay to the loop &#8216;usleep(25000);&#8217;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hoa Pham</title>
		<link>http://blog.perplexedlabs.com/2008/11/07/real-time-ajax-javascript-progress-bar/comment-page-1/#comment-2325</link>
		<dc:creator>Hoa Pham</dc:creator>
		<pubDate>Tue, 28 Apr 2009 04:57:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.perplexedlabs.com/?p=43#comment-2325</guid>
		<description>Hi all, 
It work on FF 2 &amp; IE 6, but IE 7 &amp; FF 3 does not !
:-)</description>
		<content:encoded><![CDATA[<p>Hi all,<br />
It work on FF 2 &amp; IE 6, but IE 7 &amp; FF 3 does not !<br />
:-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hoa Pham</title>
		<link>http://blog.perplexedlabs.com/2008/11/07/real-time-ajax-javascript-progress-bar/comment-page-1/#comment-2323</link>
		<dc:creator>Hoa Pham</dc:creator>
		<pubDate>Tue, 28 Apr 2009 04:25:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.perplexedlabs.com/?p=43#comment-2323</guid>
		<description>Hi Matt,
I have a prob like Erik. The progress bar only displayed when the task is done. So I can not monitor the progress of task while it running. The code is below:

Back-end php (iframe):
set_time_limit(900);
do{
   my_long_time_task();
   echo &quot;window.parent.update_prg(...);&quot;;
   ob_flush();
   usleep(25000);   
}while(!$done);

I am using PHP 5.2.9 - Apache 2.2.11
Thx</description>
		<content:encoded><![CDATA[<p>Hi Matt,<br />
I have a prob like Erik. The progress bar only displayed when the task is done. So I can not monitor the progress of task while it running. The code is below:</p>
<p>Back-end php (iframe):<br />
set_time_limit(900);<br />
do{<br />
   my_long_time_task();<br />
   echo &#8220;window.parent.update_prg(&#8230;);&#8221;;<br />
   ob_flush();<br />
   usleep(25000);<br />
}while(!$done);</p>
<p>I am using PHP 5.2.9 &#8211; Apache 2.2.11<br />
Thx</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TrazeK</title>
		<link>http://blog.perplexedlabs.com/2008/11/07/real-time-ajax-javascript-progress-bar/comment-page-1/#comment-1639</link>
		<dc:creator>TrazeK</dc:creator>
		<pubDate>Thu, 09 Apr 2009 21:49:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.perplexedlabs.com/?p=43#comment-1639</guid>
		<description>Ok, I was able to find my problem and all is well. It has nothing to do with ASP or the way it handles page buffering. The problem was I did not sleep() after each iteration and flush so there was not enough time to display each progress bar update. Now that I pause between update calls, it works as advertised. Thanks again!</description>
		<content:encoded><![CDATA[<p>Ok, I was able to find my problem and all is well. It has nothing to do with ASP or the way it handles page buffering. The problem was I did not sleep() after each iteration and flush so there was not enough time to display each progress bar update. Now that I pause between update calls, it works as advertised. Thanks again!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TrazeK</title>
		<link>http://blog.perplexedlabs.com/2008/11/07/real-time-ajax-javascript-progress-bar/comment-page-1/#comment-1632</link>
		<dc:creator>TrazeK</dc:creator>
		<pubDate>Thu, 09 Apr 2009 17:54:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.perplexedlabs.com/?p=43#comment-1632</guid>
		<description>Sorry, I mean flushing, not buffering after each iteration.</description>
		<content:encoded><![CDATA[<p>Sorry, I mean flushing, not buffering after each iteration.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TrazeK</title>
		<link>http://blog.perplexedlabs.com/2008/11/07/real-time-ajax-javascript-progress-bar/comment-page-1/#comment-1631</link>
		<dc:creator>TrazeK</dc:creator>
		<pubDate>Thu, 09 Apr 2009 16:58:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.perplexedlabs.com/?p=43#comment-1631</guid>
		<description>Thanks for your response Matt. I am indeed buffering after each iteration but what I forgot to mention is I am using classic ASP and not PHP for my backend scripting language. I am following the same logic but now suspect it&#039;s something going on with ASP and nothing else. I am going to investigate further. Thanks again.</description>
		<content:encoded><![CDATA[<p>Thanks for your response Matt. I am indeed buffering after each iteration but what I forgot to mention is I am using classic ASP and not PHP for my backend scripting language. I am following the same logic but now suspect it&#8217;s something going on with ASP and nothing else. I am going to investigate further. Thanks again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt</title>
		<link>http://blog.perplexedlabs.com/2008/11/07/real-time-ajax-javascript-progress-bar/comment-page-1/#comment-1625</link>
		<dc:creator>Matt</dc:creator>
		<pubDate>Thu, 09 Apr 2009 13:15:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.perplexedlabs.com/?p=43#comment-1625</guid>
		<description>Trazek,

Yes, it&#039;s a &quot;real-time&quot; status bar, its supposed to update dynamically.

Have you flushed and ended all of PHP&#039;s output buffering layers?

Are you flushing output after each iteration?

Is it a browser issue? (what browser are you testing in?)

-Matt</description>
		<content:encoded><![CDATA[<p>Trazek,</p>
<p>Yes, it&#8217;s a &#8220;real-time&#8221; status bar, its supposed to update dynamically.</p>
<p>Have you flushed and ended all of PHP&#8217;s output buffering layers?</p>
<p>Are you flushing output after each iteration?</p>
<p>Is it a browser issue? (what browser are you testing in?)</p>
<p>-Matt</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anselmo Battisti</title>
		<link>http://blog.perplexedlabs.com/2008/11/07/real-time-ajax-javascript-progress-bar/comment-page-1/#comment-1623</link>
		<dc:creator>Anselmo Battisti</dc:creator>
		<pubDate>Thu, 09 Apr 2009 12:47:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.perplexedlabs.com/?p=43#comment-1623</guid>
		<description>Thx for your idea, 

I was tring to do something like this but not using flush() unfortunly it&#039;s apears impossible :(.

&#039;my soluction was&#039;

 


&lt;em&gt;&lt;/em&gt;

this is out of iframe

a normal iframe with i use to execute the php functoin and it returns

echo &quot; parent.progress.setProgress(10,&#039;10 of 100&#039;);&quot;;
flush();

and finaly the js funciton 
var progress = {
	setProgress: function(percent, text)
	{
		if(percent &gt; 100 ) percent = 100;
		$(&#039;percent&#039;).innerHTML = text; 
		var largura = (percent /100) * parseInt($(&#039;container&#039;).getStyle(&#039;width&#039;) .substr(0, 3))-5;
		$(&#039;progress&#039;).setStyle( { &#039;width&#039; : largura + &quot;px&quot; });

		if (percent == 100) { 
			$(&#039;progress&#039;).setStyle({&#039;backgroundColor&#039; : &#039;green&#039; });
			$(&#039;percent&#039;).innerHTML = &quot;Processamento Concluído.&quot;;
		}
	}
}

works great :)
thx again</description>
		<content:encoded><![CDATA[<p>Thx for your idea, </p>
<p>I was tring to do something like this but not using flush() unfortunly it&#8217;s apears impossible :(.</p>
<p>&#8216;my soluction was&#8217;</p>
<p><em></em></p>
<p>this is out of iframe</p>
<p>a normal iframe with i use to execute the php functoin and it returns</p>
<p>echo &#8221; parent.progress.setProgress(10,&#8217;10 of 100&#8242;);&#8221;;<br />
flush();</p>
<p>and finaly the js funciton<br />
var progress = {<br />
	setProgress: function(percent, text)<br />
	{<br />
		if(percent &gt; 100 ) percent = 100;<br />
		$(&#8216;percent&#8217;).innerHTML = text;<br />
		var largura = (percent /100) * parseInt($(&#8216;container&#8217;).getStyle(&#8216;width&#8217;) .substr(0, 3))-5;<br />
		$(&#8216;progress&#8217;).setStyle( { &#8216;width&#8217; : largura + &#8220;px&#8221; });</p>
<p>		if (percent == 100) {<br />
			$(&#8216;progress&#8217;).setStyle({&#8216;backgroundColor&#8217; : &#8216;green&#8217; });<br />
			$(&#8216;percent&#8217;).innerHTML = &#8220;Processamento Concluído.&#8221;;<br />
		}<br />
	}<br />
}</p>
<p>works great :)<br />
thx again</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TrazeK</title>
		<link>http://blog.perplexedlabs.com/2008/11/07/real-time-ajax-javascript-progress-bar/comment-page-1/#comment-1590</link>
		<dc:creator>TrazeK</dc:creator>
		<pubDate>Wed, 08 Apr 2009 21:19:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.perplexedlabs.com/?p=43#comment-1590</guid>
		<description>Hey Matt, one more question. Is this status bar supposed to increment while the iframe is processing the request? If I use debug alert messages, I get all the status calls and the bar increments synchronously but if I take the alerts out, it appears to just to 100%. What could I be doing wrong?</description>
		<content:encoded><![CDATA[<p>Hey Matt, one more question. Is this status bar supposed to increment while the iframe is processing the request? If I use debug alert messages, I get all the status calls and the bar increments synchronously but if I take the alerts out, it appears to just to 100%. What could I be doing wrong?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
