How to call controller / action within zend through jquery / ajax?

How to call controller / action within zend through 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 does not call the controller action method, how can I achieve it?

+8
jquery php zend-framework
source share
2 answers

There was a problem that we should use single or double quotes, specifying the data transfer name in $.post(...) or $.ajax(...) , otherwise it will interpret it as a javascript object, not a name.

 $.post("<?php echo $this->baseUrl();?>/Indexcodelist/indexcodelistsearch/",{'order':orders}); ^-----^ 
+2
source share

Here is my way of working:

 <script type="text/javascript"> $('a.validate').click(function(){ //alert($(this).attr('href')); $.post('/application/object/validate',{type:'type', id:$(this).attr('href'), pkObject:$('#pkObject').val()},function(data){ return false; }); </script> 

Hope this helps.

0
source share

All Articles