Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/11/2010, 21:28
Avatar de alfcm
alfcm
 
Fecha de Ingreso: mayo-2009
Mensajes: 291
Antigüedad: 15 años
Puntos: 7
json con Zend

Hola amigos, tengo un problema al momento de enviar un arreglo ya seteado en JSON desde un metodo action de mi controller

Código PHP:
public function listarAction(){
                
        
$this->_helper->layout->disableLayout();
        
//$this->_helper->viewRenderer->setNoRender();
        
$cliente = new Model_DbTable_Cliente();
        
$result $cliente->listar();
        
        
$response->page 1;
        
$response->total=1;
        
$response->records=count($result);
        
        
$i=0;
        foreach(
$result as $fila){
            
$response->rows[$i]['id']=$fila->id;
            
$response->rows[$i]['cell']=  array($fila->nombre,$fila->apellido,$fila->tipo_cliente);
            
$i++;
        }
        
        
//header('Content-Type: text/json; charset=UTF-8');
        //$this->_helper->json($response);
        
        //echo json_encode($response);
                 
return json_encode($response);

la llamada lo hago desde un jqGrid para luego llenar mi grilla, cuando ejecuto la aplicacion solo carga mi grilla vacia

comprobe si esta bien estructurado mi respuesta json y todo esta bien

{"page":1,"total":1,"records":10,"rows":[{"id":110,"cell":["LUIS","CANO","N"]},{"id":109,"cell":["LUCHO","CUELLAR","N"]},{"id":103,"cell":["CARMEN","GONZALES","N"]},{"id":102,"cell":["TITO","FUENTES","N"]},{"id":101,"cell":["PAUL","PILCO","N"]},{"id":100,"cell":["CARLOS","GONZALES","N"]},{"id":99,"cell":["JUAN","LINARES","N"]},{"id":98,"cell":["DANIEL","SAM","N"]},{"id":97,"cell":["JAVIER","CASTRO","N"]},{"id":96,"cell":["PEDRO","CONGA","N"]}]}

No entiendo porque no carga, hice ya casi de todo, tambien hice esto:

$this->_helper->json($response); pero cuando ejecuto me muestra la ventana window para descargar un archivo, apesar que deshabilite el layout $this->_helper->layout->disableLayout();

, necesito su ayuda porfavor

Muchas gracias de antemano