2015-01-17 2 views
1

У меня есть div (id = "first") и форма ("search-form") на моей странице
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()); 
}); 
Смежные вопросы