title: How to pass a list of data between views in Zend?
body: <p>I have two dropdown list which is question and answer.
  At first the answer dropdown list is empty, after the user choose a question, then it will pass the question_id to controller to run a function to get the answer. After the controller get the result, it will pass to the correspond view. Now how can I pass the result to the index view?</p>
  
  <p>the index view:</p>
  
  <pre><code>$("#id_question").change(function() {
  var data = $("#id_question").val();
  var dataToSend = {question: data}
  var href= '&lt;?php echo $this-&gt;baseUrl('admin/comment/checkanswer'); ?&gt;';
  
      $.ajax({ type: "POST",
          url: href,
          data: dataToSend,
          success: function(response){
  
                  //do what u wana do
          }
          });
    });`
  </code></pre>
  
  <p>the controller:</p>
  
  <pre><code>public function checkanswerAction()
  {
      $this-&gt;_helper-&gt;layout-&gt;disableLayout();
  
      $question_id = $this-&gt;getRequest()-&gt;getParam('question');
  
      $answer_model = new Admin_Model_DbTable_Answer();
  $answer = $answer_model-&gt;getAnswersByQuestionId($question_id);
  
  $this-&gt;view-&gt;answer = $answer;
    }
  </code></pre>
  
  <p>the checkanswer.phtml:</p>
  
  <pre><code>foreach ($this-&gt;answer as $key =&gt; $value)
       {
           echo '&lt;option value="'.trim($value['id_answer']).'"&gt;'. trim($value['answer_text']) .'&lt;/option&gt;';
         }
  </code></pre>