ajax and components


where should I put php script which generates data for ajax which is used in component? I can’t put this into this controler, because it is not visible outside application and I need to have a URL to do the call. Should I create additional controler and model for this component? Or there is other way?



I usually create an action in an existing controller.

For example, let’s suppose that you have a table of ‘item’, stuff that have to be searched with a CJuiAutocomplete.

You need a script for retrive the items. If you have a controler ItemController (that usually is used for CRUD operation) you can add an action (actionSearch, for example) that retrives the data you need.

If you have no such a controller you can create a new one.