Reputation: 29514
i am working on rails 2.3.11 .. and running my rails application with -P blogs
and the url will be like http://localhost:3000/application_name
.
How to retrieve the above url inside the javascript of my rails view file
Please give suggestions
EDIT
localhost:3000/application_name is the base_url all over the app. I have a javascript with $.ajax with :url with "controller/action" which is not loading properly for the reason that its taking the loading page ctrllr as the ctrllr and not taking the ctrllr from the one i gave in the javascript .
Upvotes: 2
Views: 6665
Reputation: 10413
In rails basically every request specific can be found in request
. Putting arequest.inspect
may give you insight to this.
If you just need the path in your javascript, the file needs to be an erb (e.g. something.js.erb). then it would just be <%= blogs_path %>
.
If you're talking about the assets/javascripts/sprockets feature in the new rails, I don't know because I haven't used that yet.
Upvotes: 1