public function revtypesAction() { if ($this->_getParam('term', false)) { $types = new Revtypes(); $type_options = $types->getTypes($this->_getParam('term')); if ($type_options) { $response = $type_options; } else { $response = array(array('id' => NULL, 'term' => 'No options available')); } } else { $response = array(array('id' => NULL, 'term' => 'No ruler specified')); } echo Zend_Json::encode($response); }