ruby - Execute Javascript in Sinatra -


i searched lot can't seem find clear answer how execute javascript code via sinatra, symply renders code html me. here tried far :

require 'sinatra'  set :public_folder, 'public'  class dashboard < sinatra::base   '/'     send_file file.join(settings.public_folder, 'javascripts/index.js') # renders code html     '<script type="text/javascript" src="index.js"></script>' # nothing     '<script>alert("hello, world !")</script>' # works correctly   end end 

figured out, path in src must :

<script type="text/javascript" src="javascripts/index.js"></script> 

Comments

Popular posts from this blog

How to run C# code using mono without Xamarin in Android? -

c# - SharpSsh Command Execution -

python - Specify path of savefig with pylab or matplotlib -