Ajax doesn't work after using _remap |
Hi
I have added _remap() function in controller because I need to pass parameter in index, also index should work without passing parameter inside. Example with passed parameter in url: mywebsite.com/history/12 Example without parameter in url: mywebsite.com/history Both examples are working with _remap() function in controller ! Now issue that I have is that when I want to use ajax and call function in same controller it doesn't work, I get returned whole page content, but when I remove _remap() from controller then this examples mentioned above is not working, but ajax working. How this can be fixed ? Controller PHP Code: <?php View PHP Code: <script>
You do not need __remap
This should do it for you. PHP Code: $uri = (string)$this->request->uri; Try that. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
If I doesn't use _remap then I need to make url like this mywebsite.com/history/index/12 because it is saying that "page is not found", is there a way to remove that "index" from url somehow ?
Also with those you suggested I am getting errors when page is loaded Message: Undefined property: History::$request Message: Trying to get property 'uri' of non-object Message: Call to undefined method CI_URI::getSegments() EDIT I removed _remap and made route like this $route['history/(:any)'] = 'history/index/$1'; this fixed all.
Anytime that your receiving data into a method you should have a matching route.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |