Uuups, I just found out that HTML links behave the same way ... it
seems I am too pampered with Rails link helpers ;-) But I still wonder
what the easiest way would be to build correct URLs for Javascript
then.

On Jan 22, 3:01 am, Kai Schlamp <[email protected]> wrote:
> Hm, that really sounds unhandy. As mentioned, I can simply use <a
> href="profile">link</a> and the "profile" gets appended to the full
> url. It doesn't matter in that case if there is a trailing slash or
> not. Why does Javascript has that problem and standard HTML not?! Does
> someone know of a good URL library for Javascript (or jQuery)?
>
> > Pretend it's a file system...  You are in the "users" directory.  In that 
> > directory is a file called "3" and now you are asking for "profile".  
> > Without any slashes, it's going to assume that you want the file "profile" 
> > in the current directory which is "users" so you get "users/3".
>
> > It's more complicated than a file system though since you can't ensure a 
> > trailing slash.  I might remove it.  Apache might be configured to get rid 
> > of it, etc.
>
> > You can't prefix "profile" with a slash since that would pull 
> > uphttp://localhost/profile.
>
> > I think you're only option is to tweak the load() call...  to pull in the 
> > value of document.location.href and append "profile" with a possible slash 
> > to separate them if it doesn't already exist.  I don't know if 
> > jQuery/javascript has anything to make that simpler.
>
> > You might also be able to set the BASE HREF html tag, but that will most 
> > likely screw up all your image paths, etc...
>
> > -philip
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to