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:

  1. in app/assets/javscripts/application.js

    //= require main 
  2. 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

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -