Reputation: 63
I am having this problem of url stacking up. I used jquery ajax request on my localhost and the url became localhost/website/index.php/mycontroller/myfunction/mycontroller/mynewfunction instead of localhost/website/index.php/mycontroller/mynewfunction/para1/para2.
Does anyone know why? I have been trying to fix this problem for the whole day. Everywhere I checked that has a url or link appears to be right.
Upvotes: 0
Views: 127
Reputation: 18705
It's the way you're writing the URL in the function, typically I find when I run into this the easiest way to fix it is just to use the base_url function instead of trying to use relative URL's. So something like this:
<a href="<?=base_url();?>mycontroller/myfunction/para1/para2">Link</a>
That way you're always directing back to the base and working from there.
Upvotes: 1