I have a WINDOW A. I opened a popup WINDOW B from it using Javascript.
In window B I have updated several fields and pressed SUBMIT.

I wish that now after submitting the data from WINDOW B - WINDOW A will refresh to show the changes.

I've created a validation function in WINDOW B that runs on the onclick event of the SUBMIT button and this is the code :

The problem is :
Using the method described - Window A is always refreshed after window B is submitted and closed, but sometimes I see the changes reflected and sometimes not ! (it's pretty random).
It's as if - the refresh runs parallel to the submission, and sometimes it runs after , so I see the changed data, and sometimes it runs before - so I don't see any difference !

How can I solve this ???