render :update vs. render :partial -> need :update help

I am trying to make a render :update work, and couldn't find anything on the forums or in books on what I am doing wrong:

def index   render :update do |page|          page.replace_html 'asection', :text => '99' (or :partial => 'somepartial' etc.)   end end

this never works. Instead, the javascript is rendered on the page - perhaps because it failed? - instead of the result of the execution itself. Once, an alert was actually popped up (so it did execute in one case, but failed). In most cases, nothing happens other than the replacement of the element by the javascript code, which looks something like:

try { Element.update("asection", "99\n"); } catch (e) { alert('RJS error:\n\n' + e.toString()); alert('Element.update(\"asection\", \"99\\n\");'); throw e }

replacing <div id='asection'>    replace me </div>

the following always works, I don't have a problem with basic partials:

def index   render :partial => 'somepartial' end

in both cases, the controller is called from a periodically_call_remote statement

What am I doing wrong? Thanks in advance for any assistance.

try { Element.update("asection", "99\n"); } catch (e) { alert('RJS error:\n\n' + e.toString()); alert('Element.update(\"asection\", \"99\\n\");'); throw e }

replacing <div id='asection'>   replace me </div>

the following always works, I don't have a problem with basic
partials:

def index render :partial => 'somepartial' end

in both cases, the controller is called from a periodically_call_remote statement

Are you passing :update to periodically_call_remote? If so, don't
(that tells prototype that you'll be giving it a chunk of data to
insert rather than some js to execute.

Fred

Most likely you're using th :update option of periodically_call_remote

In this case it expects pure html as response and will treat your js as such Just kkep out the :update, your page.replace tells the browser what to replace anyway