2014-01-21 34 views

回答

0

繼承人一個jQuery版本

$(document).ready(function(){ 
    $('#add').click(function(){ 
      $.ajax({ 
       url:'/yourcontroller/youraction', 
       type:'post', 
       data:{'division':$('#divison_textbox').val(),'major':$('#major').val()}, /*add the res*/   
       success:function(data){ 
       $('#your_tableid tbody').append(data); 

       }    

      }); 

    }); 
    }); 

    //in zend youractionAction 

    public function youractionAction(){ 
    $this->_helper->layout->disableLayout(); 
      $this->_helper->viewRenderer->setNoRender(); 
    //get all your post variables ,save it to database and if successfully saved then build a row 
    $returndata ='<tr>'; 
    $returndata .='<td>'.$division.'</td>'; 
    //etc... 
    $returndata .='<tr>'; 


    just echo it 
    echo $returndata;exit;  
    }