Base URL issue? jQuery is getting confused, among other things... |
[eluser]slamtastic[/eluser]
Hey all. I'm still pretty new to CI and have run into this snag a couple times when building text projects. Basically, methods, links and pages get lost from time to time. For instance, this simple jQuery function gives error that follows: Code: $(document).ready(function() { Code: POST http://xampp.local/ajax_home/home http://xampp.local/ajax_home/home 404 Not Found 42ms This is what my config file looks like: Code: $config['base_url'] = "http://xampp.local/testsite"; My Xampp Vhost setup: Code: <VirtualHost *:80> Finally, my local hosts file: Code: 127.0.0.1 xampp.local localhost Pretty dern straight ahead, right?! What am I missing here?
[eluser]slamtastic[/eluser]
ajax_home.php is a file that resides in the same dir as the other view files. home is a method in ajax_home.php
[eluser]pistolPete[/eluser]
[quote author="slamtastic" date="1234794207"]ajax_home.php is a file that resides in the same dir as the other view files.[/quote] If it is a controller, it must be in ./system/application/controllers.
[eluser]slamtastic[/eluser]
Right. But, it's not a controller. It's just another view file with a simple function: Code: function home() {
[eluser]pistolPete[/eluser]
But if you want to access it like you wrote above, it must be a controller! Have a look at the user guide: Controllers
[eluser]xwero[/eluser]
You can't access view files directly, it always has to go through a controller. So if you put ajax_home.php in the application/controllers directory and change the code to Code: class Ajax_home extends Controller
|
Welcome Guest, Not a member yet? Register Sign In |