struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lbastil <basti-unterw...@gmx.de>
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
(targets="...")
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
updating.

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,
basti
-- 
View this message in context: http://www.nabble.com/-S2--why-is-javascript-executed-before-DOM-is-updated-tp14313561p14313561.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message