0

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/controllers/

3 Answers 3

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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" }

3 Comments

Dont we need extension as php
What? aaah. no not at all. In a Zf app everything goes thru index.php and the right controller with the right view are called.
Also you might want to look up modrewrite and routing in zend framework to help you understand.
0
f(a==b){ } 
    else{ 
         document.myform.action="/controllername/actionname" 
    }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.