On 14 Mar, 17:38, "pbd22" <dush...@gmail.comwrote:
On Mar 14, 10:12 am, Randy Webb <HikksNotAtH...@aol.comwrote:
pbd22 said the following on 3/14/2007 12:48 PM:
Hi.
I am trying to poll a long-running process via a hidden IFrame.
I am noticing that the online errata gives advice for handling a
server response:
What "online errata"?
window.parent.handleServerResponse();
The problem I am having with this is that the above function
gets called ***after*** the long-running response is completed.
How do I poll the long-running process ****as**** it is being
executed? Say, every 5 seconds or so?
You have the long-running process update a file on the server. Then you
check the file for the status. It could be as trivial as setting a
variable to false and when it finishes changes that variable to true.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/
Hi Randy,
Thanks for your reply.
Well, that particular function comes from the below link:
http://www.bazon.net/mishoo/rpc.epl
But, the "online errata" that I have been following most closely has
been the bit about RPCs by the engineers at Apple:
http://developer.apple.com/internet/...nt/iframe.html
In both cases, I have found that when my long-running process
(in this case a video upload via hidden iframe) has completed,
the client-side function gets called.
I want to poll the long-running process **as it is happening**. The
polling routine will query information provided by the server page
(bytes uploaded, percent, total bytes, time, etc) and return that
information to the client in intervals of a few seconds for an in-
process client-side progress display.
I am glad to hear this isn't too complicated. I am wondering if you
wouldn't mind providing the steps, code, links, or whatever you think
could help me get my mind wrapped around what I am trying to do. I'd
apprecaite that.
Thanks again.
Peter
why not have a second iframe, hidden like the first (OR use XHR), but
this one is used to receive data.
you /can/use the other one provided it is able to keep flushing small
bits of javascript back. In the past I have found the simpler way was
to keep querying a 2nd iframe (or scriptin using XHR) whose source is
"are_we_there_yet_papa_smurf.php?filename=uploaded filename"
or where a session is set and the filename is not needed to be sent.
that way the are_we_there_yet_pap_smurf.php script can stat the
uploading file, perform the calculations and send back the data inside
script tags, (or when using XHR, pre JSON data for security)
a receiving script in the parent then uses this javascript data to
update the DOM with the details.
you call are_we_there_yet_pap_smurf.php using an interval (or
setTimout) based on a variable sent back, doagain = 1, on upload
succeeded the variable is changed to doagain = 0; and the thing
updates once with the final data, and stops.
Does that all make sense?