struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lbastil <>
Subject [S2] why is javascript executed before DOM is updated
Date Thu, 13 Dec 2007 10:31:33 GMT

I have a serious problem with an ajax submit.

the scenario is the following:

I submit a form with ajax submit button and I want to update the parent div
The original content of this div and the result content contains a <script>
section with
javascript at the very end.

Now the following happens: after pressing the submit button the ajax call is
done correctly.
But after that at first the script is executed, then the DOM is updated by
replacing originally div 
content with the result from ajax call.

But this is not what I would expect. The javascript for instance changes
some things (like
enabling / disabling form elements), which are then overwritten by the DOM

The interesting thing is: originally the content of the div is also loaded /
filled by ajax mechanisms,
but not triggered from <s:submit>. In this first case the javascript is
executed on the exact
order, where it is placed in the code. Why not when doing it via <s:submit>?

Can anybody explain me what is going on here and suggest a workaround?

Thank you very much in advance,
View this message in context:
Sent from the Struts - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message