Ajax jquery error code 500

Hello, I have a problem with JQUERY AND AJAX, When I try to insert something in the database through a form, it throws me this error, it works perfectly on localhost but it doesn’t work here.

When I make the request it does not work or insert the data in the database


What is the jQuery code you are using to do this?

$(document).ready(function () {

$(document).on('click', '.btnClientSave', function () {

    let nombre = $.trim($(".nombre").val());

    let apellido = $.trim($(".apellido").val());

    let email = $.trim($(".email").val());

    let telefono = $.trim($(".telefono").val());

    if (nombre.length == 0 || apellido.length == 0 || email.length == 0 || telefono.length == 0) {

        let error = "Dejaste Algun Campo Vacio"


    } else {

        let data = {

            'nombre': nombre,

            'apellido': apellido,

            'email': email,

            'telefono': telefono



            type: "post",

            url: "clientes/nuevo",

            data: data,

            success: function (response) {



                alertify.set('notifier', 'position', 'top-right')







I am using codeigniter 4 too

Are you sure this is correct?


The response code says 500 (Internal Server Error). That means your jQuery code is probably OK, because it seems to be sending the request to the PHP backend. However, the 500 status code means the PHP backend is crashing.

What you can do is enable Display Errors through the control panel (see the link KangJL shared), then open the web page, open the Network tab in the developer tools of your browser and try submitting the form again. In the Network tab, you should be able to see the request to the PHP code, and see the content being returned. You should see a PHP error message there, which you can then try to tackle.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.