0

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.

1
  • 2
    Can we see the javascript code with the URL you're posting to? You probably need an absolute URL instead of a relative one. Commented Nov 5, 2012 at 3:08

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for helping me. I actually have the same problem but when loading up a view.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.