I'm a novice Rails programmer, and I'm currently trying to create a simple form that takes a name, email address, and phone number, and then when you click a button, it refreshes the page with what you entered with Ajax.
i.e. if you enter User, user@example.com and 555-555-555 in the text fields of the form and click "Submit", you should receive
Name: User Email: user@example.com Phone: 555-555-555
I know this is a simple question, but I'm not quite sure how to write JavaScript to make it work.
Here is my code for partial:
<%= form_for(@user, :remote => true) do |f| %>
Name: <div="Name"><%= f.text_field :name %></div>
Email: <div="Email"><%= f.text_field :email %></div><br/>
Phone Number: <div="Phone Number"><%= f.text_field :phone_number%></div><br/>
<%= f.submit "Submit" %>
My controller is as follows:
class UsersController < ApplicationController
def new
@user = User.new
end
def create
@user = User.new(params[:user])
end
end
create.js.erb .update, - ?