I'm having a very similar problem!!

I have a form of 3 steps and I'm using Ajax.Request to update the
contents of a div between the steps and also do some other checks.

>From step1 to step2 everything is fine. I submit my form and get a new
div (with some html+js) to replace the first step with the second
step.  After the second step when I go to the last step I see the Div
getting updated but the whole page just disappears right after the div
is updated with the new html+js returned from the ajax request.

The problem is somewhere in the <script> tag that I return. When I
remove the <script> tag the div gets updated normally but I don't have
my js code working which is a very crucial part of the page. Also when
I run the html+js code directly in a div everything works fine, it
fails only when I get the same code from Ajax.Request.

My request function looks like this:

myFunc = function(){
        $('myForm').request({
                onSuccess: function(req){
                        var r;
                        if(!req.responseText.isJSON()){
                                $('myErrorDiv').update('Show some errors');
                                return;
                        }
                        else{
                                r = req.responseText.evalJSON();
                        }

                        if(r.hasErrors){
                                $('myErrorDiv').update(r.errorMsgs);
                        }
                        else{
                                $('myMainDiv').update(r.response); //response 
contains html+js
                        }
                }, evalJS: true
        });
}

Thank you...

On Aug 3, 2:13 pm, Christophe Porteneuve <[EMAIL PROTECTED]> wrote:
> kreatik a écrit :
>
> > it's possible to evalSscript:true withAjax.Updater but not view the
> > js ? (with html+jsresponse)
>
> No idea what you mean.
>
> When A.U gets an HTMLresponsewith <script> fragments, it extracts the
> script fragments from theresponseand inserts the remaining HTML in the
> DOM.  Now if the evalScripts option is true, the extracted scripts then
> get evaluated.
>
>    http://prototypejs.org/api/ajax/updater
>
> --
> Christophe Porteneuve aka TDD
> [EMAIL PROTECTED]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to