Codeigniter 4 ajax post results in 404 error |
I am trying to handle a form submit using the JQuery ajax function on localhost xampp. However, the following always results in a 404 page not found error:
Code: $(document).on("click", ".iconsTop .iconst", function (e) { Controller: PHP Code: class App_home extends BaseController Router PHP Code: use CodeIgniter\Router\RouteCollection; After submitting the form, I always get the following error in Google Chrome's page inspector: Quote:jquery-3.7.1.min.js:2 POST http://localhost/app/public/filter 404 (Not Found) Quote:404 Controller or its method is not found: Filter::index
Why there is public in your url ?
Have you set base_url with public ? Can you try to change $routes->get('filter', 'App_home::filter'); to $routes->get('/filter', 'App_home::filter'); (05-21-2024, 10:28 AM)pippuccio76 Wrote: Why there is public in your url ?Should I delete public? My baseurl is as: Code: public string $baseURL = 'http://localhost:80/'; I change to `$routes->get('/filter', 'App_home::filter');` but there is the same error
Did you try like this?
PHP Code: $.ajax({ 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 |