Announcement Announcement Module
Collapse
No announcement yet.
Best place for common ajax autcomplete methods in Controllers? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Best place for common ajax autcomplete methods in Controllers?

    Hi,

    In my application I've got several pages which use the same ajax call for a jquery autocomplete field. Where would be the best place to put the method to avoid duplication of code? There a requite a few autocompelte fields, things like occupation, country, address etc

    I've considered using a base controller to extend all my other controllers and putting the common autocomplete methods in there, or instead I've thought about adding interceptors to catch the url map.

    What do you think is the best approach?

    Thanks

    Huntygowk

  • #2
    Answering my own question here. I've simply created a new controller called AjaxAutocompleteController with all the different ajax autocomplete methods in it, and this will pick up the ajax requests whenever they are called from any page as well. No need to create a base controller or use interceptors. Definitely a case of simple is best I think.

    Comment

    Working...
    X