开发者

Rails 3 remote link displays RJS code on page

开发者 https://www.devze.com 2023-01-26 09:29 出处:网络
I have a Rails 3 app that uses a remote/AJAX link to update a partial on the page.In my view, I have the following:

I have a Rails 3 app that uses a remote/AJAX link to update a partial on the page. In my view, I have the following:

<%= link_to 'link text', {:action => 'update_detail开发者_开发知识库s'}, :remote => true %>

That action in my controller has the following:

render(:update) do |page| page.replace_html 'details', :partial => 'details' end

Instead of updating with the HTML in the 'details' partial it redirects to a page that prints the RJS code for doing that:

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

I don't get a Javascript error of any kind and I'm including all the necessary Javascript files, including Prototype.


please include csrf_meta_tag helper in the header..

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号