Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call controller/action in zend framework via jquery/ajax?

How to call controller/action in zend framework via jquery/ajax?

I tried this

<script>
     $(function() {
         $(".tbl_repeat tbody").tableDnD({
            onDrop: function(table, row) {
            var orders = $.tableDnD.serialize();
            $.post("<?php echo $this->baseUrl();?>/Indexcodelist/indexcodelistsearch/",{order : orders });
    }
    });
 });
 </script>

this code isn't calling the controller's action method, how do i achieve it?

like image 241
kapil Avatar asked Dec 15 '14 07:12

kapil


1 Answers

Problem occurred that we have to use single or double quotes when giving the name of passing data in $.post(...) or $.ajax(...) otherwise it interpret it as an javascript object not a name.

$.post("<?php echo $this->baseUrl();?>/Indexcodelist/indexcodelistsearch/",{'order':orders});
                                                                            ^-----^
like image 191
Indrasinh Bihola Avatar answered Nov 13 '22 12:11

Indrasinh Bihola