Thanks for the reply.  Apparently evalScripts doesn't work for Ajax.Request().

According to the documentation in
http://wiki.script.aculo.us/scriptaculous/revision/Ajax.Request:

Note: even though the Rails helpers inject it as an option, the
'evalScripts' option does not work with Ajax.Request. See Ajax.Updater
if you want 'evalScripts' to work.


I'm using Ajax.Updater() now, and it works great.  Thanks for the lead!



On 4/12/06, Gregory Hill <[EMAIL PROTECTED]> wrote:
> Add 'evalScripts: true' to your options on the Ajax.Request constructor.
>
> Setting innerHTML with javascript does not cause the javascript to be
> invoked.
>
> Greg
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> [mailto:rails-spinoffs-
> > [EMAIL PROTECTED] On Behalf Of Al
> > Sent: Wednesday, April 12, 2006 1:05 PM
> > To: rails-spinoffs@lists.rubyonrails.org
> > Subject: [Rails-spinoffs] innerHTML and scripts not running
> >
> > Hello,
> >
> > I'm having an issue with getting embedded javascript code to actually
> > run when loaded via an Ajax.Request() call and the callback function
> > inserts the generated HTML and js code to my current page.  It seems
> > that the javascript code is not properly parsing.
> >
> > For example, I'm using the following function showinfo() to return
> > some html code.
> >
> > function showInfo(go_url){
> >     if($("display_area") && go_url){
> >
> >         var xmlHttp= new Ajax.Request(go_url, {method: "post",
> >                 parameters: Form.serialize(document.forms[0]),
> >                 onComplete:function(){
> >
> >             if(xmlHttp.responseIsFailure()) {
> >                 var sts = xmlHttp.transport.status ? xmlHttp.
> >                 transport.status : "undefined";
> >                 $("debug_msg").value=
> >                 "XMlHttpRequest returned response status "+sts;
> >                 document.getElementById("debug_msg").innerHTML=
> >                 "HTTP response and server information; "+
> >                 "response status="+
> >                 xmlHttp.transport.status;
> >             } else {
> >                 document.getElementById("display_area").innerHTML
> > =xmlHttp.transport.responseText;
> >
> >               document.getElementById("debug_msg").innerHTML=
> >                 "HTTP response and server information; "+
> >                 "response status="+ xmlHttp.transport.status;
> >             }
> >         }});
> >     }
> > }
> >
> >
> > Now, in the line
> >
> >
> document.getElementById("display_area").innerHTML=xmlHttp.transport.resp
> on
> > seText;
> >
> > Generated by the link saved in go_url, I have html code that I derived
> > from the examples in ajax_inplaceeditor_test.html to appear in between
> > my <div id="display_area"> tags.  The inplace editing functionality
> > works when I run the go_url link on its own, but when I embed it in
> > the manner above, the html properly appears, but the code does not
> > run.
> >
> > Am I doing the right thing to use innerHTML?
> >
> >
> > -Al
> > _______________________________________________
> > Rails-spinoffs mailing list
> > Rails-spinoffs@lists.rubyonrails.org
> > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to