Here is what you need:
form_tag( { :controller => :magic, :action => :search, :method => post }, { :remote => true } ) do ....
This is kind of poor design, but the Rails form_tag methods require two hashes - a hash of url_for parameters and regular hash settings. This caused a lot of confusion for many Rails programmers. If you do not add hash boundaries, all parameters are passed to url_for (), destroying :remote => true .
This will add data-remote="true" to your form (for use with unobtrusive javascript, as others have mentioned). From there, you need to create the appropriate AJAX for the binding to complete the request.
Although you really should use a named route like magic_search_path , instead of controller / action parameters.
adamlamar
source share