dino d. wrote:

> I'm trying to create a widget where my rails code generates a fresh
> widget (which is javascript) to replace the old one.  To do this, I
> need to insert new javascript with AJAX with RJS (so my partial begins
> with <script...).  Is this possible?  Right now, it replaces the old
> widget div with nothing and I get no errors.  Is this a browser
> safeguard or something?

Wouldn't your controller action look like this?

   def xhr_whatever
     render :update do |rjs|
       rjs.replace :my_div, '<script> js blah blah blah </script>'
     end
   end

The stack should handle escaping, javascript-ing, escaping, transmitting, 
de-escaping, evaluating, and de-escaping that.

But I'm sure there's a better way to write your actual feature. I sling Ajax 
here and there all the time and never once found a need to push a '<script>'...


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to