Skip to content Skip to sidebar Skip to footer

How To Access Environment Variable From Rails On Your Javascript?

I am trying to set up a key system in the application I'm building. I have a code that has this logic: $('.key-test-button').on('click', function(){ if ($('.key-test-input').va

Solution 1:

As @davidhoelzer mentioned, you can't do this with pure js (as far as I know)... you could, however, change the .js file to .js.erb and use ruby to access/manipulate your environment variable that way.


Post a Comment for "How To Access Environment Variable From Rails On Your Javascript?"