ejemplo de consulta ajax-jquery

PHOTO EMBED

Wed Feb 07 2024 19:52:30 GMT+0000 (Coordinated Universal Time)

Saved by @jrg_300i #undefined

$.ajax({
    url: 'ruta/al/controlador',
    method: 'GET',
    dataType: 'json',
    success: function(response) {
        // Manipula los datos recibidos en la respuesta
        for (var i = 0; i < response.length; i++) {
            var nombre = response[i].nombre;
            var apellido = response[i].apellido;
            var cedula = response[i].cedula;
            console.log(nombre + ' ' + apellido + ' - ' + cedula);
        }
    },
    error: function(xhr, status, error) {
        // Maneja los errores de la solicitud
        console.error(error);
    }
});
content_copyCOPY