Rails Order of Execution

Hi

I have an RJS file that has scriptaculous page calls and system()
function calls. They're in the order of system(), scriptaculous,
system(), system(), scriptaculous. It seems that all the system()
functions get executed first, then the scriptaculous effects. Is there
anyway to have my code get executed in the original order? For example,
the first system call stops a recording, and first scriptaculous call
displays a "saving" <div> tag; the other two system() tag saves the
recording, and the final scriptaculous call displays a "recording
completed" <div> tag.

Any help is appreciated
Xeph

The scriptaculous calls merely generate JavaScript that will eventually
be sent to the client. Your RJS file is executed and rendered by the
server, all your system() calls will happen now, and the JavaScript
required to produce the effects on the frontend will have been
generated – not executed. The generated code is then sent to the
client (your browser) where it is then executed and you see the fancy
effects.

You’ll need to perform some ajax calls from the frontend that respond
with RJS to trigger the system() calls on the server. You’ll need one
ajax call per system() call (unless you group them up) which will
obviously take quite a while with any more just a couple of remote
calls. Not to mention that you’ll need to keep and eye out for clients
that don’t perform the full number of requests that you’d expect.

My advice is to keep your design as simple as possible, it sounds like
you’re going to end up with a lot of complex code just for the benefit
of having effects fire in “real” time.