How to start with AJAX/JSON in Zend?
- by Awan
I am working on some projects as a developer(PHP,MySQL) in which AJAX and jQuery is already implemented. But now I want to learn implementation of AJAX and jQuery stuff. Can anyone tell me the exact steps with explanation?
I have created a project in Zend. There is only one controller(IndexController) and two actions(a and b) in my project now. Now I want to use ajax in my project. But I don't know how to start. I read some tutorial but unable to completely understand.
I have index.phtml like this:
<a href='index/a'>Load info A</a>
<br/>
<a href='index/b'>Load info B</a>
<br />
<div id=one>load first here<div>
<div id=two>load second here</div>
Here index is controller in links.
a and b are actions.
now I have four files like this:
a1.phtml
I am a1
a2.phtml
I am a2
b1.phtml
I am b1
b2.phtml
I am b2
I think you have got my point.
When user clicks first link (Load info A) then a1.phtml should be loaded into div one and a2.phtml should be loaded into div two
When user clicks second link (Load info B) then b1.phtml should be loaded into div one and b2.phtml should be loaded into div two
And someone tell me the purpose of JSON in this process and how to use this also?
Thanks