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

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -