I\'m new to Rails and JQuery so I\'ll try to explain this as best I can. I\'m trying to pass my JQuery datepicker values to my rails controller. The page has data on it tha
From your log data, this is in the Parameters
:
"event"=>{"start_date"=>"12/06/12", "end_date"=>"12/13/12"}
which means start_date
and end_date
are in a Hash called event
, so your controller should look like this:
def dateFilter
eventIn = params[:event]
@events = Event.find(:all, :conditions => ["EVENT_DATE_TIME_LOCAL BETWEEN ? AND ?", eventIn[:start_date], eventIn[:end_date]])
respond_to do |format|
format.html
format.json { render json: @events }
format.js
end
end
One other small thing - the form_tag
class
should be set like so:
<%= form_tag({:controller => 'events', :action => 'dateFilter'}, :class => 'date_form', :remote => true) do %>