Reputation: 2234
I have a situation where I need to call a path relative to the current url pretty straight forward, however for some reason when I make the execute the url part of the current url gets lost and I do not know why.
In other words I am currently a this webpage.
localhost:<port>/X/View/12345
and in my html I have a basic anchor tag:
<a class="btn btn-link w-full" href="Export"><i class="fa fa-file-excel-o pull-left"></i><span class="pull-right">Export</span></a>
I would think that when I click the link the browser would go:
localhost:<port>/X/View/12345/Export
However I end up with:
localhost:<port>/X/View/Export
I was hoping someone could give some points at what to look at, or why this could be happening?
Note:
href="12345/Export"
. localhost:<port>/X/View/12345
I can't seem to work out why I am loosing the id part of the url? :(
Upvotes: 0
Views: 46
Reputation: 1069
Since there is no slash after 12345 it's considered by your browser a file not the directory
In localhost:/X/View/12345
to go to localhost:/X/View/12345/Export
Relative url has to be
<a class="btn btn-link w-full" href="12345/Export"><i class="fa fa-file-excel-o pull-left"></i><span class="pull-right">Export</span></a>
either that or you have to do a url rewrite or redirect for /X/View/12345 to be /X/View/12345/
Upvotes: 1