Results 1 to 2 of 2

Thread: Best place for common ajax autcomplete methods in Controllers?

  1. #1
    Join Date
    Aug 2009
    Posts
    6

    Default 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. #2
    Join Date
    Aug 2009
    Posts
    6

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •