Jump to content


This topic is now archived and is closed to further replies.


how to use jquery with ajax to get data ? (on Zend )

Recommended Posts



im working on zend framework , i want to get data from database using ajax , than use it for diffrente function of javascript , but i dont know how to use it , and i dont know if i need to open new php page for using the ajax and get methood , how to use the jquery with ajax to get data ?. is it possible also to use jquery with ajax as it is or i need differnte command in zend ?


Thx avi.

Share this post

Link to post
Share on other sites

there are a few choices available to you in the framework:

1) create an aync / ajax controller :


you can create an ajax conroller, and in the init method of the controller you disable the view from rendering using:

public function init()

then an example method you will call could be  /MyajaxController/getmyinfo/var1


public function getmyinfoAction(){
$result = (database array or whatever);//array - stuff from database
echo json_encode($result);



2) read up on zend frameworks context switching. this is the preferable method, as you wont then need a specific ajax controller. the context switching allows you to use your normal controllers, and basically says ' if this call is ajax then return json etc......

Share this post

Link to post
Share on other sites

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.