Thursday, August 29, 2013

loading file into js variable in Rails app

loading file into js variable in Rails app

In a Rails app I need, in a js file
(app/assets/javascripts/projects.js.coffee), to load into a variable the
content of a file. The file is now stored at app/templates but I can move
it elsewhere if a different location will make it work.
I tried
$.get "app/templates/project.mustache", (template) ->
console.log template
Just to see, as first step, if the file was loaded but I get
GET http://localhost:3000/app/templates/project.mustache 404 (Not Found)
What's the right way to achieve so?
Thanks

No comments:

Post a Comment