title: How to filter part of view in zend framework
body: <p><img src="https://i.stack.imgur.com/0qo4P.png" alt="enter image description here"></p>
  
  <p>I have a view in zend in which we have the form to submit entry and on bottom we have listed the previous entries. i have applied the search functionality and its working fine when we click on search button. Now what i want is to apply search on keyup event using getJSON event so we can instantly search the content.   </p>
  
  <p>I have added two condition for seach...for search using search button click.</p>
  
  <pre><code>  if($req-&gt;isPost()) {
  
          {
              //$ajaxPostedData = $req-&gt;getPost();
          $ajaxPostedData = $req-&gt;getParams();
          //echo $ajaxPostedData['search_term'];
          $select-&gt;where("ma_heading like '%".$ajaxPostedData['search_term']."%'");       
          //$select-&gt;where($val)
          //echo $select-&gt;__toString();die;
          //print_r($data = $db_model-&gt;fetchAll($select));
          //die;
          //echo $select-&gt;__toString();
  
          return $data = $db_model-&gt;fetchAll($select);
  
          # Paging section
          $paginator = Zend_Paginator::factory($data);
          $paginator-&gt;setItemCountPerPage(PAGING_RESULT_PER_PAGE);
          $paginator-&gt;setCurrentPageNumber($page);
          $paginator-&gt;setPageRange(PAGING_PAGES_RANGE_PER_PAGE);
          $this-&gt;view-&gt;data = $paginator;
              //$this-&gt;_helper-&gt;P($ajaxPostedData);die;
              //
  
  
      }
  </code></pre>
  
  <p>and for keyup event </p>
  
  <pre><code>if($req-&gt;isXmlHttpRequest())
          {
              //$ajaxPostedData = $req-&gt;getPost();
          $ajaxPostedData = $req-&gt;getParams();
          //echo $ajaxPostedData['search_term'];
          $select-&gt;where("ma_heading like '%".$ajaxPostedData['search_term']."%'");       
          //$select-&gt;where($val)
          //echo $select-&gt;__toString();die;
          //print_r($data = $db_model-&gt;fetchAll($select));
          //die;
          //echo $select-&gt;__toString();
  
          return $data = $db_model-&gt;fetchAll($select);
  
          # Paging section
          $paginator = Zend_Paginator::factory($data);
          $paginator-&gt;setItemCountPerPage(PAGING_RESULT_PER_PAGE);
          $paginator-&gt;setCurrentPageNumber($page);
          $paginator-&gt;setPageRange(PAGING_PAGES_RANGE_PER_PAGE);
          $this-&gt;view-&gt;data = $paginator;
              //$this-&gt;_helper-&gt;P($ajaxPostedData);die;
              //
          }
  </code></pre>
  
  <p>But the content is not replace dynamically when we are searching the content on keyup.</p>
  
  <p>Please help me how can i apply keyup search in zend.</p>
  
  <p>This is the jQuery script which i have used to send request </p>
  
  <pre><code>jQuery('#txt_heading_filer').keyup(function() {
          var heading = jQuery('#txt_heading_filer').val();
  
          $.getJSON('admin/admin/announcements/search_term/'+heading, function() {            
  
          });
      });
  </code></pre>
  
  <p>This is the table which need to refreshed on search</p>
  
  <pre><code>&lt;table width="100%" border="0" cellspacing="0" cellpadding="0" class="top-table-bg"&gt;
          &lt;tr&gt;
              &lt;th width="" align="left"&gt;&lt;?php echo $obj_trans-&gt;_('heading'); ?&gt;&lt;/th&gt;
              &lt;th width="20%" align="left"&gt;&lt;?php echo $obj_trans-&gt;_('expiry date'); ?&gt;&lt;/th&gt;
              &lt;th width="10%" align="center"&gt;&lt;?php echo $obj_trans-&gt;_('publish/unpublish'); ?&gt;&lt;/th&gt;
              &lt;th width="10%" align="center"&gt;&lt;?php echo $obj_trans-&gt;_('action'); ?&gt;&lt;/th&gt;
          &lt;/tr&gt;
          &lt;?php  
          foreach($data_arr as $key =&gt; $data) { ?&gt;
          &lt;tr&gt;
            &lt;td align="left" class="name" &gt;&lt;span&gt;&lt;?php echo $data[PREFIX_MASTER_ANNOUNCEMENTS . 'heading']; ?&gt;&lt;/span&gt;&lt;/td&gt;
            &lt;td align="left" class="name"&gt;
            &lt;?php echo (!empty($data[PREFIX_MASTER_ANNOUNCEMENTS . 'expiry_date'])) ? date("j", strtotime($data[PREFIX_MASTER_ANNOUNCEMENTS . 'expiry_date'])).'&lt;sup&gt;'.date("S", strtotime($data[PREFIX_MASTER_ANNOUNCEMENTS . 'expiry_date'])).'&lt;/sup&gt; '.date("M, Y", strtotime($data[PREFIX_MASTER_ANNOUNCEMENTS . 'expiry_date'])) : "N/A"; ?&gt;
            &lt;/td&gt;
            &lt;td align="center"&gt;
              &lt;?php Admin_View_Helper_GeneralHelper::status_icon($data[PREFIX_MASTER_ANNOUNCEMENTS . 'status']); ?&gt;&lt;/td&gt;
            &lt;td align="center"&gt;
              &lt;a href="javascript:;" class="info_tooltip update_data" title="Edit" rel="&lt;?php echo $data[PREFIX_MASTER_ANNOUNCEMENTS . 'id']; ?&gt;" id="link_edit"&gt;&lt;?php echo $this-&gt;img("img/admin/icons/edit.png", array('id' =&gt; 'icon_edit')) ?&gt;&lt;/a&gt;
  
              &lt;a href="&lt;?php echo $this-&gt;url(array('controller' =&gt; 'admin', 'action' =&gt; 'announcements', 'do' =&gt; 'delete', 'item' =&gt; $data[PREFIX_MASTER_ANNOUNCEMENTS . 'id'])); ?&gt;" class="info_tooltip delete_data" title="Delete" rel="&lt;?php echo $data[PREFIX_MASTER_ANNOUNCEMENTS . 'id']; ?&gt;" id=""&gt;&lt;?php echo $this-&gt;img("img/admin/icons/delete.png", array('id' =&gt; 'icon_delete')) ?&gt;&lt;/a&gt;
            &lt;/td&gt;
          &lt;/tr&gt;
          &lt;?php } ?&gt;
  
        &lt;/table&gt;
  </code></pre>