Rashmi Anand
Rashmi Anand

Reputation: 81

Rails js.erb not executing javascript

I am building a search form in my rails app using simple_form.

Code in my view

= simple_form_for :principal, url: url_for(action: 'analyze', controller: 'principals', format: :js, dataType: 'script'), method: :get, remote: :true do |f|
  = f.input :category_id, input_html: {name: :category_id }
=f.button :submit

Code in analyze.js.erb

alert("check");

In response tab it is showing me alert("check");

but on completion of request it is not showing me alert box.

Upvotes: 1

Views: 527

Answers (1)

Vitalyp
Vitalyp

Reputation: 1089

Looks like errors in analyze.js.erb. You retrieved the js response, but javascript is not valid.

Upvotes: 1

Related Questions