public function medcatrulerAction() { if ($this->_getParam('term', false)) { $rulers = new Rulers(); $rulerOptions = $rulers->getMedievalRulersAjax($this->_getParam('term')); if ($rulerOptions) { $response = $rulerOptions; } else { $response = array(array('id' => '', 'term' => 'No options available')); } } else { $response = array(array('id' => NULL, 'term' => 'No category specified')); } echo Zend_Json::encode($response); }