public function rulersperiodAction() { if ($this->_getParam('term', false)) { $rulers = new Rulers(); $response = $rulers->getAllRulers($this->_getParam('term')); } else { $response = array(array('id' => NULL, 'term' => 'No period specified.')); } echo Zend_Json::encode($response); }