Rails 3 form_for ajax call -


i have method in controller:

def work_here  @company = company.find(params[:id])  current_user.work_apply(current_user, @company)  redirect_to company_path end 

on view:

<%= render 'companies/work_form' if signed_in? %> 

_work_form.html.erb:

<%= form_for company, :remote => true, :url => { :controller => "companies", :action => "work_here" } |f| %> <%= f.hidden_field :id, :value => company.id %> <%= f.submit "i working here" %> 

<% end %>

and have work_here.js.erb file:

$("#work_at_form").html("<%= escape_javascript("render('companies/works')") %>") 

but form works without ajax request(in other pages ajax forks fine), js.erb file never use. can give me advise? thanks.

the work_here.js.erb can't read because never call it. redirect allways do. render when request js format.

def work_here  @company = company.find(params[:id])  current_user.work_apply(current_user, @company)  respond_to |format|    format.html { redirect_to company_path }    format.js { render }  end end 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -