Semantic-ui: Search : Appending parameter to search query before making ajax call

Created on 6 Mar 2016  路  3Comments  路  Source: Semantic-Org/Semantic-UI

In the Search Module I would like to know if it is possible to add parameters to the search query before making the ajax call.

For example, I have right now the url is given like this :

  apiSettings: {
      url: '/dashboard/verbatims/autocomplete/tag?q={query}'
  },

but the problem is I need to add another paramter "topic" to that url, but I cannot hardcode it because the topic parameter might change, so I need to append the currently set value before making the search.

Is it possible to have a "beforeQuery" hook ?

For example:

searchObj.search({
    apiSettings: {
        url: '/dashboard/verbatims/autocomplete/tag?q={query}',
        beforeQuery: function(queryobj){
            // adding topic parameter to query object 
            queryobj.topic = getCurrentTopic()
            // then continuing the make the ajax call 
            return queryobj
        }
    },
Should Post to Forum - See Readme Usage Question

All 3 comments

Check out our API docs

Hi, thanks for posting, unfortunately although your question is valid, this is a usage question, and not appropriate for posting on GitHub Issues.

To help make this board manageable for maintainers to effectively work on actionable changes to the library, we've limited posts on this board to specific bug reports or feature requests. To see how we differentiate between the two, please check out our Contributing Guide.

To help get answers to your question (or get feedback that might allow you to repost this issue) you might want to check out one of our other support resources.

Ok understood. I was going to post of StackOverflow, but I thought it would be more relevant if I ask the question to the source.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

miguelmota picture miguelmota  路  3Comments

mixerp picture mixerp  路  3Comments

larsbo picture larsbo  路  3Comments

kntmrkm picture kntmrkm  路  3Comments

mllamazares picture mllamazares  路  3Comments