Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 290577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:00:37+00:00 2026-05-12T06:00:37+00:00

I wanted to implement an ajax based autocomplete feature for my searchbox, and i

  • 0

I wanted to implement an ajax based autocomplete feature for my searchbox, and i came across, implementing autocomplete in my website.

Now what i wanted to know was that i attach a datasource to the control, but so far i have seen that the datasource requires a textbase schema, can’t i like it to a query, where it control calls the query and it returns the records on which the filter of the control must apply.

Hope my question is clear

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T06:00:38+00:00Added an answer on May 12, 2026 at 6:00 am

    How do you think you can link it to a query on client-side??
    You can link it to an AJAX call to the server, which returns the option-list.
    The control’s filter will do the rest filtering on that option-list.

    The best practice would be, to fire an AJAX on page load, to a server function, which will query to the database (MySQL in your case) and fetch the options-list in json format. Assign the option-list to as an input for autocomplete. (Its obviously better than to fire a ajax-request everytime user starts to type-in the search box.)

    If you use jquery it can be something like this.

    $(function(){  //runs on page load
    
    $.ajax({
      type: "POST",
      url: "/searchlist/", //server function that returns the search list
      data: '',
      dataType: "json",
      success: function(json){
        search_choices = json.list; // search option list
        $("input#searchbox").autocomplete(search_choices, {
                                   max: 4,
                                   scroll: false,
                                   autoFill: true,
                                   multiple: true,
                                   matchContains: true,
                                   multipleSeparator: " ",
                                   width: 180
                                 });
    
      }
    });
    
    });
    

    I can provide you with example in libraries other than jquery, but i hope this can make you find your way.

    Edit: No, your database needn’t to have sorted choices. It is your server function, that should be doing all the sorting. Use,

    autocomplete( url_to_server_function, options)
    

    and your server function will get search term (keyword user types in search-box), as get request. Filter your database there, and this is the place where you can hook related words along with the results. Just make a list of everything you want to show as suggestion, and return in serialize json format and let autocomplete to take care of matching and sorting the data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Wanted to get some consensus around a UI feature I'm working on right now.
I wanted to implement a windows service that captures dropped flat delimited files to
hi im working with PHP application. Now i wanted to implement the URL rewrite
I wanted to implement an app that prevents calls like a firewall. When I
I wanted to implement my own debug function that has the same signature as
So I've recently written an application that calculates tip and I wanted to implement
I wanted to implement SoftHashMap based on Java SoftReference and HashMap . Java docs,
I wanted some of those spiffy rounded corners for a web project that I'm
I wanted to do something like this: <asp:Label ID=lblMyLabel onclick=lblMyLabel_Click runat=server>My Label</asp:Label> I know
I wanted to create a web chat. It was suggested that i use Php

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.