All threads / rails - javascript doesnt work on herokuapp

Ask A Question

Notifications

You’re not receiving notifications from this thread.

rails - javascript doesnt work on herokuapp

Reckordp asked in Servers

I know this question is asked a lot in old posts

but, no one has fixed my problem. The problem is an error in the web console

TypeError: e is undefined
ReferenceError: ubah_tampilan_menu is not defined
I tried to execute an html.erb file

<% RuangDepanController::Daftar_Menu.each do |m| %>




<%= link_to(m, "javascript:ubah_tampilan_menu('#{m}')") %>



<% end %>
The code calls this Javascript script, written in Coffeescript

@ubah_tampilan_menu = (menu) ->
xhr = new XMLHttpRequest()
xhr.open('GET', "bentuk_loading")
xhr.onreadystatechange = ()->
document.getElementById("Pertujukan").innerHTML = xhr.responseText

ubah_menu_sebenarnya(menu)
xhr.send()

on localhost: 3000 of these codes work well. But after deploying heroku I received the message above. First I looked for the function and I found it in the web debugger. I use Rails 5.2.2 and Mozila Firefox. Any idea?

(Sorry for bad English)

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 37,344+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.