ruby - Javascript file not executing in Sinatra application -
app.rb
require 'sinatra' '/' haml :home end home.haml
!!! %html %head %title app %body .wrapper %script(src="js/app.js") folder structure:
/myapp/app.rb /myapp/views/home.haml /myapp/public/js/myapp.js the template seems load javascript file:

however not execute. javascript draws html5 canvas , appends wrapper div. if type in url "localhost:4567/js/myapp.js" script shown, i'm assuming sinatra correctly serving up, it's not executing.
fixed, forgot add jquery script, script wasn't loading because using $(document).ready functionality.
Comments
Post a Comment