【发布时间】:2010-05-26 23:19:48
【问题描述】:
以下内容在 text_field 中。
= f.text_field :title, :size => 50, :onchange => remote_function(:update => :suggestions, :url => {:action => :display_question_search_results})
以下内容在 display_questions_search_results.rjs 中。
page.insert_html :bottom, 'suggestions', :partial => 'suggestions'
每当用户键入时,我都想在数据库中搜索与文本字段中的关键字匹配的任何元组。然后,显示这些结果。但是,目前,_suggestions.haml 只包含“suggestions!!”这个词。
但是,而不是看到“建议!!”在suggestions div 标签中,我得到:
try { Element.insert("suggestions", { bottom: "suggestions!!" }); } catch (e) { alert('RJS error:\n\n' + e.toString()); alert('Element.insert(\"suggestions\", { bottom: \"suggestions!!\" });'); throw e }
我一直试图找出这样做的原因,但我发现之前提出的问题似乎比我正在做的更复杂......
【问题讨论】:
标签: ruby-on-rails partial-views rjs