Farzan Najipour
Farzan Najipour

Reputation: 2503

Zend Framework replacing div with another div

I have a div (id = "first") and a form ("search-form") in my page
div shows all record of my table in the database . In form, user can limit result by his text in form. I want to replace new div with basic one.


View:

 <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>

Upvotes: 1

Views: 67

Answers (1)

satchcoder
satchcoder

Reputation: 797

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

But you have to do this when the doc is loaded so in the

$( document ).ready(function()
{
  $('#first').html($('#last').html());
});

Upvotes: 0

Related Questions