using jquery to post data in zend framework?

Answer

This is an example of basic usage of calling Zend Controller with ajax/json and get response to the same phtml, so you can use it in your code.

In .phtml file I have javascript which call (in IndexController) the action ajaxAction():

<scriptlanguage="Javascript">var param1 ='first';//or get value from some DOM elementvar param2 ='second';//or get value from some DOM element

jQuery.ajax({
      url:'/default/index/ajax',
      type:'POST',
      data:{param1: param1, param2:param2 },
      dataType:"json",
      success:function(result){var return1 = result.return1;var return2 = result.return2;// return1 and return2 is value from php file.// fill out DOM element or do the windows.location()}});</script>

All zend-framework Questions

Ask your interview questions on zend-framework

Write Your comment or Questions if you want the answers on zend-framework from zend-framework Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---