zend和jquery / ajax动态添加和删除行

时间:2014-01-21 08:18:07

标签: javascript php jquery ajax zend-framework

我仍然掌握我的zend技能,而不是真的很好,但我一直在研究如何编写代码,通过它添加并使用zend框架动态删除行。 ... http://www.amitpatil.me/ajax-table-adding-removing-rows-dynamically-using-javascript-animation/

关于如何解决这个问题的任何建议都会非常感激。在网上找到的图片来获得一个想法

enter image description here

提前致谢

1 个答案:

答案 0 :(得分: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;    
    }
相关问题