On Nov 22, 12:02 am, Joe Blow <[EMAIL PROTECTED]>
wrote:
> How does page.update actually work? I know its a wrapper for
> Prototype.update but how does it get the partial in there?
>
> Say I wanted to update a div with the contents of a partial manually
> like this.
>
> content = render(:partial => 'whatever')
> page.call "$('my_div').update(#{content})"
>
> But his does not work. It keeps giving me weird errors about &nbsp;
> tags. Any clues?

That's now how you are supposed to use page.call. The first argument
is supposed to be the function to call (ie $('my_div').update) and
subsequent arguments are arguments to pass through. What your code
does is ask the browser to execute

$('my_div').update(<span>some html here</span>)
(assuming that was the html content), ie the string literal is not
quoted and is just dumped in there. There is no need to use page.call
here  though as page.replace_html handles this already (see
http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper/JavaScriptGenerator/GeneratorMethods.html#M001446
)

Fred
--~--~---------~--~----~------------~-------~--~----~
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 [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-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to