在Zend中组织AJAX调用

I wanted to do a nice organization of all my AJAX calls. I was thinking of having a folder called "Ajax" inside application folder, and inside have all the ajax files.

So I want, say the IndexController, to have /ajax/IndexController/ or something like that. Basically, I want a whole set of controllers for the ajax, but all in the ajax folder.

How do I accomplish this?! And how do I call them then?!

Thanks! Kousha

You can create an AjaxController for each module, and place the actions in it. Then, from the javascript, call the actions :

    $.post(
        "yourbaseurl/ajax/index",
        data: params,

        "json"
        );

The ajax functions for an administrator module will go into the controller administrator/AjaxController.php.

Another approach is put everything in an ajax folder and use routes and .htaccess to handle the routing. This would be a good read