After removing respond_to
and render to view
, everything seems to be working smoothly, but when I include the js render
, I encounter an error.
controller code :
if params[:stock].present?
@data = params[:stock]
@stock = Stock.new_form_lookup(params[:stock])
respond_to do | format |
format.js {render partial: 'user/result'}
end
else
flash[:danger] = "no search found "
redirect_to my_portfolio_path
end
end
View code:
<%= form_tag searchstock_path , remote: true , method: :get, id:"stock-search" do %>
application.js code:
//= rails-ujs
//= require jquery
//= require bootstrap
//= require jquery_ujs
//= require turbolinks
//= require_tree .