2015-01-17 2 views
1

내 페이지에 div (id = "first")와 양식 ("search-form")이 있습니다.
div는 데이터베이스에있는 내 테이블의 모든 레코드를 표시합니다. 양식에서 사용자는 양식의 텍스트로 결과를 제한 할 수 있습니다. 새 div를 기본 div로 대체하려고합니다.
Zend Framework div를 다른 div로 바꾸기


보기 :

<div class="datagrid" id="first"> 
    <table> 
     <tr> 
     <th>id</th> 
     <th>num</th> 
     </tr> 
     <?php 
      foreach ($this ->paginator as $key =>$value) 
      {  
       echo '<tr> 
         <td>'.$value->id.'</td> 
         <td>'.$value->num.'</td> 
       </tr>';               
      } 
     ?> 
    </table> 
</div> 
</div> 
<div class = "pagination"> 
    <?php 
     echo $this->paginationControl($this->paginator,'Sliding','pagination.phtml'); 
    ?> 
</div> 
<div class= "search-form"> 
     <?php 
     echo $this->form; 
     echo $this->errorMessage; 
     ?> 
</div> 
<div class="datagrid" id = "last"> 

    <table> 
     <tr> 
      <th>id</th> 
      <th>num</th> 
      </tr> 
     <?php 
        for ($i=0 ; $i<$this->rowCount; ++$i) 
        {  
          print '<tr><td>'. ($this->rowArray[$i]['id']).'</td>'; 
          print '<td>'. ($this->rowArray[$i]['num']).'</td>'; 
        }?> 
    </table> 
</div> 

답변

0
$('#first').html($('#last').html()); 

그러나 문서가로드 될 때이 작업을 수행해야하는

$(document).ready(function() 
{ 
    $('#first').html($('#last').html()); 
}); 
을 너무
관련 문제