论坛首页 编程语言技术论坛

remote_function without rjs

浏览 1819 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2008-03-28  
.erb
<div id="customer_out">
    <%= render :partial => "customer", object => @customer_out%>
</div>


.erb
  
<%= f.text_field :username, :onchange => remote_function(:update => "customer_out",
                                                                                                          :with => "'username='+$(this).value + '&come_from='+$('customer_out[come_from]').value",
                                                                                                          :url =>{:action => 'check_customer'} ) %>



.rb
 
  def check_customer
    @customer_out = CustomerOut.find(:first, :conditions => ["username = ? and come_from = ?", params[:username], params[:come_from]])
    if @customer_out
      @customer_out = CustomerOut.new
      @consignee = @customer_out.customer.consignees.find(:first)
     end 
    render :partial => 'customer'
  end  
  
论坛首页 编程语言技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics