我正在尝试使用 form_tag 和 get 方法来实现 Ajax。我认为我做错了,并想就如何做到这一点寻求建议!
<%= form_tag("/event_feed", method: "get") do %>
Interests: <%= text_field_tag(:keywords, params[:keywords], :placeholder => "Business, Food, Dance", :class => 'keyword') %>
Enter Zip or City: <%= text_field_tag(:code, user_location, :class => 'zip') %>
Distance in miles: <%= select_tag(:distance_from_code, options_for_select(amount), :class => 'dist') %>
<% #select_tag(:page_result, options_for_select(amount)) %>
<!--Dates hidden with css, selected by time slot-->
<%= select_date start.to_date, :prefix => :start_date %>
<%= select_date start.to_date + 1.day, :prefix => :end_date %>
<% #hidden_field_tag :start_date, start.to_date.strftime("%Y%m%d") %>
<% #hidden_field_tag :end_date, end_time.to_date.strftime("%Y%m%d") %>
<!--Pass on the selected time frame & amount of results required -->
<%= hidden_field_tag :start_time, start %>
<%= hidden_field_tag :end_time, end_time %>
<%= hidden_field_tag :page_result, 30 %>
<%= submit_tag "Submit", class: "search" %>
我不想将表单传递给 url 参数/我不介意,但是我如何使用 Ajax 做到这一点?