Forum

Returning

David
13 July 2011, 13:58
Hello, I have a CGI script that needs to return some data to the client, then do some system work (may take 20-30 seconds) and then return more data. So far I haven't been able to achieve this result (the script doesn't write data as the commands get executed, rather, it writes everything in a single shot when its execution ends). Is it even possible to achieve with Hiawatha what I described above? Thank you.

Hiawatha version: Hiawatha v7.3, IPv6, URL toolkit
Operating System: OpenWRT Backfire 10.03.1-RC5, r27164
David
13 July 2011, 13:58
Oops, didn't complete writing the header. Silly me. :-\
David
13 July 2011, 14:58
Nevermind, I figured it out (the WaitForCGI option)
Yassen
13 July 2011, 18:23
Hi David,

I would recommend using AJAX for this kind of response. Just return a whole page to the user with the first set of data; show a "Loading..." image/text; then have a JavaScript code check for the second set of data being ready, say every 2-3 seconds. When it gets ready, load it via AJAX and insert it where appropriate in the page. (Just an idea -- seems more user friendly as well as you don't need to allow for long-running CGI processes.)
Yassen
13 July 2011, 18:28
Offtopic (apologies):

BTW, just noticed that you run OpenWRT Backfire 10.03.1-RC5. Is that compiled from source? As I don't see it released here: http://downloads.openwrt.org/backfire/
This topic has been closed.