Hey Jan,

Nothing in Ajax.Request auto-evals anything [1].  Your using innerHTML 
won't eval scripts magically, as well.

If you're fetching HTML with <script> tags, you can use this for dealing 
with your response:

$('newContent').update(response);

This WILL extract the <script> elements, and eval them 10ms after having 
updated innerHTML (as a DOM update safeguard).

Better yet, use Ajax.Updater [2] for your need.  It would look something 
like:

new Ajax.Updater('newContent', 'test2.htm', {
   method: 'get', evalScripts: true });

Still better: if you're ONLY fetching JS, make it a .js file and 
Ajax.Request to it: since your server will return a JS-compatible MIME 
response type (e.g. text/javascript), A.R will auto-eval responseText.

[1] http://prototypejs.org/api/ajax/request
[2] http://prototypejs.org/api/ajax/updater

-- 
Christophe Porteneuve aka TDD
[EMAIL PROTECTED]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to