I am running a request via Ajax.Updater with evalScripts = true and an
onComplete function.

I find that my onComplete function executes before the script content has
been evaluated. Looking through prototype.js (v. 1.5.1) this seems to be
caused by the scripts being executed as part of this line (1352):

    setTimeout(function() {html.evalScripts()}, 10);

So the onComplete function will always run first.

Besides putting a timeout in my onComplete function is there a way to make
my script run after the call to evalScripts?

Simple example showing this problem:

*File 1: index.htm*


    <script type="text/javascript" src="prototype.js"></script>
    <script type="text/javascript">
        var x = 10;
        function tellMe() {
        function populate() {
            new Ajax.Updater("target", "content.htm", { onComplete: tellMe,
evalScripts: true });
    <a href="#" onclick="populate();">Populate</a>
    <div id="target">Content goes here</div>

*File 2: content.htm*

**<div>AJAX Content</div>
<script type="text/javascript">


The first alert shows 10, the second, 11.


You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 

Reply via email to