Ajax get request for js (js.erb in rails) - url/naming problems?

Did you have correct route for /profile/profile. Js?

Did you have correct route for /profile/profile. Js? Resources :profiles get :profile end After do that, you can try again.

Doesn't work :( – butterywombat Mar 20 at 19:42.

The index action renders by default index.html. Haml or index.js. Erb, but you can tell it to render profile.js.

Erb if that is what you want... Your get action has nothing to do with the file rails serves. Change your controller to something like this: def index respond_to do |format| format. Js { render 'profile/profile' } end end.

But what if I want it to make an ajax GET to get profile.js. Erb when I click something, and make a different request to anotherscript.js. Erb when I click something else?

– butterywombat Mar 20 at 19:44 profile.js. Erb and anotherscript.js. Erb are just files... Rails will not serve them up to the world in any way.. except if you have controller actions which render them.So to answer your question you first need to set up a new route and a new action controller just like the one above which servers anotherscript.js.

Erb instead. Then you can do an ajax to the controller action which is mapped in your routes. Index is a default route for your controller, you should define another.

A very good guide here. – alexcepoi Mar 20 at 22:16.

I decided to put everything in index.js. Erb and only run the sections I need conditionally...

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions