Hello, I have problems sending data via json. If something look bad me know please. I feel I have error in the foreach
In my controller
public function buscarProductoAction(){
            $sql = "
            select ART_CODIGO, ART_NOMBRE, nvl(ART_costo,0)  as costo,ART_UNIDADC as UNIDAD, NVL(ART_IVA,0) AS IVA from SPM_ARTICULO WHERE ART_ESTADO<>'A'  AND ART_NOMBRE LIKE   "."'%".$_GET['term']."%'";
        $robots = $this->db->fetchOne($sql);
        foreach ($robots as $robot) {
            $return_arr[]=array('id'=>$robot['ART_CODIGO'],'ART_NOMBRE'=>$robot['ART_NOMBRE'],'COSTO'=>$robot['COSTO'],
                                'UNIDAD'=>$robot['UNIDAD'],'IVA'=>$robot['IVA']);
        }
        $this->response->setContentType('application/json', 'UTF-8');
        return $this->response->setJsonContent($return_arr)->send();
    }In my view
<script>
            $(function() {
            $(".auto").autocomplete({
            source: "buscarProducto",
            minLength: 1,
            select: function(event, data) {
                    $("#codigo").val(data.item.id);
                    $("#iva").val(data.item.IVA);
                    $("#precio").val(data.item.COSTO);
                    $("#unidad").val(data.item.UNIDAD);
                    $("#producto").val(data.item.ART_NOMBRE);
                    $(".auto").val(data.item.ART_NOMBRE);
                    $("#cant").focus();
                    },
                });
        });
</script>In the jquery i have this problem
jquery.js:9203 GET https://localhost/tesis/spt_encabezado/buscarProducto?term=m 500 (Internal Server Error)It is ERROR
try {
                    // Do send the request (this may raise an exception)
                    xhr.send( options.hasContent && options.data || null );I feel I have error in the Loop