开发者

How do call the controller and action from javascript in Zend framework

How do call the Controller/action in Zend framework from Javascript such as if(a==b){ } else{ document.myform.action="/fz/controllername/actionname" }

My controllers are located in the src/controll开发者_运维百科ers/


Since a JS Call is just a regular web call you do it the same way you would access any other Action of your Project, the question is how you handle the output.


Just call it like any other urls. If I had a news controller and wanted to post there from a form I would just set the form`s action to: '/news' and be done with it.

To expand on this a bit if I had a post action in my news controller I would set

if(a==b){ } else{ document.myform.action="/news/post" }


f(a==b){ } 
    else{ 
         document.myform.action="/controllername/actionname" 
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜