title: How to add a new ZF2' Zend\Form\Element within jQuery ajax
body: <p>I want to add a new ZF2' Zend\Form\Element within jQuery ajax. But while I use the Zend Form , I don't know how to make it. This is the add.phtml file.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
   $(document).ready(function(){
      $(".pid").change(function(){
      var id = $('.pid').val();
      var $_this = $(this);
       $.ajax({
              type:"POST",
              url:"&lt;?php echo $this-&gt;url('Element/default',array('action'=&gt;'change'));?&gt;",
              data:"pid="+id,
              dataType:'json',
              async:false,
              success:function(data){
                  if(data.response){
                     //here I want to add a new select  component after select conponent "pid" using like "$this-&gt;formRow($form-&gt;get('mid'))" or else .   
                  }
              }
      });
    });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>the following is the remaining part of the html.</p>
  
  <pre><code>&lt;?php
  $title = 'add';
  $this-&gt;headTitle($title);
  ?&gt;
  &lt;h1&gt;&lt;?php echo $this-&gt;escapeHtml($title); ?&gt;&lt;/h1&gt;
  
  &lt;?php
  $form = $this-&gt;form;
  
  $form-&gt;setAttribute('action', $this-&gt;url(
  'Element/default',
  array(
      'action'     =&gt; 'add'
   )
  ));
  $form-&gt;prepare();
  
  echo $this-&gt;form()-&gt;openTag($form); 
  echo $this-&gt;formRow($form-&gt;get('pid'));
  echo $this-&gt;formRow($form-&gt;get('name'));
  echo $this-&gt;formRow($form-&gt;get('desc'));
  echo $this-&gt;formSubmit($form-&gt;get('submit'));
  echo $this-&gt;form()-&gt;closeTag();
  </code></pre>
  
  <p>How do I add a new zend form element within jquery ajax ? Thanks.</p>