I can't send a AJAX request in a codeigniter server |
Hello, everybody.
I'm developing an app in codeigniter 4, the fact is that I have already correctly configured my test server and when I make a request via ajax it returns 404 and "index.php", I have already tried everything and the problem still remains ![]()
With the few information you give, it may be because your ajax request doesn’t call the right URL or there’s an error in your route configuration.
(08-18-2020, 03:47 AM)InsiteFX Wrote: If you want help on this you will need to show your controller code and ajax code.Here is my code JavaScript Code: $(document).on('submit', '#login', function(e){ Controller PHP Code: <?php namespace App\Controllers; Routes.php PHP Code: /*Rutas para login*/ In the development Enviroment works perfectly, but in a Docker container not,
Try this your url is wrong.
PHP Code: url: "<?= base_url(login/signin');?>", What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
If your Docker dosen't work, it dosen't read the .htaccess file to enable SEO-friendly URLs, nothing to do with CodeIgniter. If your urls work with index.php/signin, you could use site_url() to generate said urls. But that would mean all your urls contain index.php just because a miss-configured docker environment.
A little late to the party here but, feeding jreklund's post, if your using apache, make sure your mod_rewrite is enabled.
I was having this problem on an ajax myself and as soon as I looked at my .htaccess file it hit me square between the eyes that was what I forgot to do.
Totally offtopic, but md5() and passwords are a very bad idea ! https://www.php.net/manual/en/function.md5.php
Could it matter weather it's a GET or a POST request? I'm quite certain that if you use GET the controller method doesn't need a route...
hey guys, sorry by the late, I fix it!!, the reason: the httaccess files cannot reading by the apache2, so, i fix the container with a volume, thanks a lot for the help
|
Welcome Guest, Not a member yet? Register Sign In |