jquery - Loading JavaScript File With Rails -
so running rails 3.2. in assets/javascripts
folder have file "main.js.erb
". contents of file follows:
$(function(){ $(document).load(alert("hello")) })
my application.js file default generated after install initiated 'rails new
'.
any ideas why load
event not being triggered?
since application.js
default, haven't included file usage.
following different ways can include file:
in
app/assets/javscripts/application.js
//= require main
in template file or layout file eg. app/views/layouts/application.html.erb
<%= javascript_include_tag "main" %>
for further details please refer the asset pipeline railsguides.
Comments
Post a Comment