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

  • Home
  • SEARCH
  • 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 6686187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:08:36+00:00 2026-05-26T05:08:36+00:00

I have a form here that I can get to autocomplete with hard-coded items

  • 0

I have a form here that I can get to autocomplete with hard-coded items in the problem-categories text field: http://www.problemio.com/add_problem.php by using this jquery code:

$("input#autocomplete").autocomplete({
    // Have to load stuff from db.
    source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"]
});

What I am not sure how to do is to construct it using category names returned by making an ajax call. Could someone help explain the flow or post some pseudo-code for how this is usually done?

Thanks!!

  • 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-26T05:08:36+00:00Added an answer on May 26, 2026 at 5:08 am

    You’re looking for the documentation, which even includes three examples of this.

    Autocomplete can be customized to work with various data sources, by
    just specifying the source option. A data source can be:

    • an Array with local data
    • a String, specifying a URL
    • a Callback

    The local data can be a simple Array of Strings, or it contains
    Objects for each item in the array, with either a label or value
    property or both. The label property is displayed in the suggestion
    menu. The value will be inserted into the input element after the user
    selected something from the menu. If just one property is specified,
    it will be used for both, eg. if you provide only value-properties,
    the value will also be used as the label.

    When a String is used, the Autocomplete plugin expects that string to
    point to a URL resource that will return JSON data. It can be on the
    same host or on a different one (must provide JSONP). The request
    parameter “term” gets added to that URL. The data itself can be in the
    same format as the local data described above.

    The third variation, the callback, provides the most flexibility, and
    can be used to connect any data source to Autocomplete. The callback
    gets two arguments:

    • A request object, with a single property called “term”, which refers to the value currently in the text input. For example, when the
      user entered “new yo” in a city field, the Autocomplete term will
      equal “new yo”.
    • A response callback, which expects a single argument to contain the data to suggest to the user. This data should be filtered based on the
      provided term, and can be in any of the formats described above for
      simple local data (String-Array or Object-Array with label/value/both
      properties). It’s important when providing a custom source callback to
      handle errors during the request. You must always call the response
      callback even if you encounter an error. This ensures that the widget
      always has the correct state.

    The label is always treated as text, if you want the label to be
    treated as html you can use Scott González’ html extension. The demos
    all focus on different variations of the source-option – look for the
    one that matches your use case, and take a look at the code.

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

Sidebar

Related Questions

so here's the problem I have one form, it outputs search results after submit,
Here's a problem I ran into recently. I have attributes strings of the form
Here is what I am trying to accomplish. I have a form that uses
I have a URL that is being generated using GET variables from a form
I have a form. The form contains a text field inside of a div.
I have a form that you can add data to a database. It is
Here is what I did: 1. I have a template WORD file that can
I have the following jquery Autocomplete form that pulls data in from a local
Here's the problem. I have a form with various inputs and a submit button.
We currently have a form with the standard multi-select functionality of here are the

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.