Rectangle 27 0

jquery js.erb not executing javascript but is processed rails?


.erb.html
.slim
def pupil_leads
   # some code here
  respond_to do |f|
    f.js { render layout: false, content_type: 'text/javascript' }
    f.html
  end
end
xhr

Add layout: false option to the render block:

Also keep in mind, a single error in your js and all may fail silently - even an initial console.log statement on the first line. Start with only a console.log statement in your js file, then slowly add pieces back until the console.log statement doesn't appear - which means there is an untracable (in rails) bug somewhere in the latest code you pasted back.

Thank you. Can you possibly give a short explanation as to why this is needed? Just for reference.

Thanks so much, I was going totally crazy with this. One of those "wish I had asked sooner and saved a dozen hours" ones. Thanks again.

for debug async action use Chrome/Network response tab, here you always can see whats wrong with your server response.

Note