0
저는이 양식을 가지고 있습니다.이 양식은 어떤 모델에도 속하지 않으며, 내가 원하는 양식입니다. 나는 그것을 아약스를 통해 제출하는 방법을 알아 내려고 노력했다.하지만 제대로 작동하지 않기 때문에 잘못된 일을해야 할 것이다.Rails 3.2.8 원격 양식이 작동하지 않습니다.
양식 태그가 '원격'속성으로 렌더링되지만 양식에 아무 곳에서나 추가 된 것은 없음을 확인할 수 있습니다. 나는 또한 다음을 추가했다. 그렇지 않습니다.
jquery와 jquery_ujs가 모두 페이지에로드됩니다.
= form_tag('/signup', :method => "get", :remote => true, :id=> 'signup-form') do
%label{:id => 'signup-label', :for=> 'signup-box'}
Enter your email address
= text_field_tag "signup-box", params[:signup], :class => 'text', :required => true, :id => 'signup-box'
= submit_tag "Sign Up", :id => 'signup'
컨트롤러 :
class SignupController < ApplicationController
def index
puts "***************************************************"
puts "email sign up"
puts "***************************************************"
render :nothing => true
end
end
%form{ :action => "/newsletter", :confirm => "Are you sure?", :remote => true, :method => "post", :id => "newsletterForm"}
%p
= label_tag(:q, "Subscribe to our newsletter:")
%p
= text_field_tag(:q, nil, :placeholder => "Your email address")
= button_to("Subscribe", :remote => true)