RunJavascript in loop

RunJavascript in loop

I am using Progress bar on one screen and it is working fine on our development environment. It uses following jquery : "$('#" + ProgressBarId + "').find('.ui-progress').css('width', '" + Progress + "%')

Now I am executing this runjavascript in a loop based on some step size. It mentions that I don't need to use Ajax refresh to make it to work.

One our other server, it is acting weirdly and screen is not refreshing after each step size but after a long time and it get stuck there for a long time. It seems that runjavascipt is not pushing the updates to webpages each time it is executed.

What happens when you execute runjavascript in a loop ? Does page get submitted automatically ? There are no errors in console. Page is getting updates from runjavascript function but not in each loop. So progress bar get stuck on 0% and then will move to 45% after some time. As I am using stepsize to divide total elements into 20 parts, it should happen like 5%, 10%, 15 %.. etc. and this is how it works on development environment.
I think my main question is how runjavascript submit changes to page. I would assume at the end of the request in which case I need to use ajax refresh but clearly this is not what is happening on development environment.

Yes, you're right, that's the main question. The page is not submited every Runjavascript execution. I assume that in a loop it should queue the scripts to be executed. Maybe it is getting lost in this... Try to put an alert after your jquery and see if it executes in the client all times.

So as expected, it showed the alert on each step before changing progress bar width.
But the question remains what stops this to work on another environment ?
What mechanism/process can I look into ?
What does outystems use behind the scenes to make this to work without ajax refresh ?

When executed in the Server, RunJavascript will queue a script to be executed after the page is loaded in the client. So if you run it several times in the context of the same request, it will add more scripts to the queue.

So the logic you have works in your Development environment, but not in the other one (Production?), is that it? Can you share an eSpace with an example of the logic you're using?