404 not found! |
The way it is working (and that part does work OK) is when I type localhost in the browser, the Users controller with the login function is running.
The question is "without modifying the default controller is there anyway for me to access function register() in Subit_backend.php from a xhr Extension"? I modified Subit_backend to be: class Subit_backend extends CI_Controller { public function __construct() { parent::__construct(); $this->load->database(); $this->load->helper('url'); } public function register() { } } but when i type localhost/Subit_backend.php/register or localhost/Subit_backend/register or even just localhost/Subit_backend from the browser address bar I still get Error 404. Can i assume that when I type localhost/Subit_backend/register I am actually typing c:/xampp/htdocs/Users/login/subit_backend/register ?
proof that an old dog can learn new tricks
No. the default controller is *only* executed if your original URL maps to a folder without an explicit controller identified.
localhost/subit_backend.php/register will look for a subit_backend.php file in your document root. localhost/subit_backend/register will look for a Subint_backend controller inside application/controllers, and will try to invoke its register method. It sounds like you would benefit from carefully re-reading the CI user guide sections on routing.
I read it and found a section called "Using HTTP verbs in routes". So I will try:
$route['subit_backend']['GET'] = 'subit_backend/register'; I am hoping that this will invoke subit_backend::register. Btw, this did not work! I get the same 404. I am hoping to invoke the register method in the Subit_backend controller when I call xhr.open("GET", "http://localhost/Subit_backend/register", true); I am concerned that this is not a problem with the ci backend, but is instead a problem with the xhr.open or the client permissions. Do you know of any way to prove which part is the problem so I can zero in on that problem?
proof that an old dog can learn new tricks
I'm starting to suspect that you get a true 404 error message and not just Codeigniters 404.
Just to clarification, can you access your user/login with the following URL: localhost/user/login If not, does it work with the following URL? localhost/index.php/user/login If it does, you need to do these steps to get rid of index.php https://www.codeigniter.com/user_guide/g...x-php-file After that the following url should start working: localhost/subit_backend/register Instead of: localhost/index.php/subit_backend/register
Yes. there are definately two different 404 messages (I don't know which one is the CI one). I have attached each showing what address led to it. Do you still think I should remove index.php after seeing this?
proof that an old dog can learn new tricks
"404 Page Not Found" = Codeigniter
"Object not found!" = Apache/Webbserver error Either you remove index.php with the link provided above or you need to include index.php in ALL your urls: localhost/index.php/subit_backend/register localhost/index.php/user/login (or users/login, as I made a typo on your controllers name) etc...
Well, that seemed to work! Thank you so much. I haven't managed to get the callback from the xhr.send (in the Extension)working yet, but at least I don't get a 440 error anymore!
proof that an old dog can learn new tricks
Here is a good read on XHR:
MDN mozilla - XMLHttpRequest (XHR) 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 |