English 中文(简体)
铁路3 - 部分 j
原标题:Rails 3 - render partial js.erb

我有一个简单的搜寻形式,看着这样的情况:

app/views/search/index.html.erb

<%= form_for @search, :as => :search, :remote => true, :url => {:action => "query"}, :html => {:id =>  search-form } do |f| %>
  ...
<% end %

<div id="search-results"></div>

页: 1

def index
  @search = SearchCriteria.new
end

def query
  @search = SearchCriteria.new(params[:search])

      # otherwise, perform search...
  @summaries = do_search @search
  respond_to do |format|
    format.js
  end
end

I then have a js.erb template: *app/views/search/_query.js.erb*

$( #search-results ).update("<%= escape_javascript(render(@summaries)) %>");

然而,我看不出任何东西被引入搜索结果。 我是否需要某种模板才能使“......”成为一种模版? 如果是的话,那将是什么名字,我会把它放在什么地方(即:评估/调查/研究?) (一) 使用舱和铁路3)

感谢。

最佳回答

您应更名为模板文件:

app/views/search/_query.js.erb => *app/views/search/query.js.erb

没有必要强调

问题回答

暂无回答




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签