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 8680037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:08:34+00:00 2026-06-12T21:08:34+00:00

I am using jQuery’s autocomplete function to fetch possible input labeles/values from suggest_address.php .

  • 0

I am using jQuery’s autocomplete function to fetch possible input labeles/values from suggest_address.php.

It looks like this:

enter image description here

Normally suggest_address.php returns an associative array of label and value .

But since suggest_address.php determines whether the input is of type “zip” or type “city”, I return an additional key/value pair: “type” :”city” or “type” : “zip”.

I want to store this value as an attribute in the input box so that it could it could be used in later queries.

How do I do this?
I know the source parameter for the autocomplete function could be a function that receives request, and response, but how do I get the response from it without modifying the source?

Right now my initialization looks like this:

$('#addresssearch').autocomplete({
                    source: 'suggest_address.php',
                    minLength: 2
                });
  • 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-06-12T21:08:34+00:00Added an answer on June 12, 2026 at 9:08 pm

    Your data object for each response can include any other key/value pairs you want. They then get included in the ui argument of event handlers.

    For exeample

    { label:'Chicago', value:'chicago', bestPizza: 'Chicago Pizza'}
    
    
    $('#addresssearch').autocomplete({
        source: 'suggest_address.php',
        minLength: 2,
        select: function(event, ui) {
            var pizza = ui.item.bestPizza;
        }
    });
    

    For a jQueryUI live demo example clcik on “View Source” in following API demo:

    http://jqueryui.com/autocomplete/#custom-data

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

Sidebar

Related Questions

Using jQuery Ajax to fetch data from local server: it works well with IE8
Using Jquery AJAX to get a value from a PHP script. This line works
Using jQuery and backbone.js, I would like to separate the JavaScript from the HTML
Using jQuery validation - validating on blur: $('input, select, radio, checkbox').blur(function(){ $(#createAccount).validate().element(this); }); If
using jquery's .post i send do my php code an object that with var_dump
Using jQuery Nearest Element , I would like to select elements in a circular
Using jQuery, how can I get the input element that has the caret's (cursor's)
Using jQuery. I have the following html: <input type=checkbox name='something' value='v1' /> All the
Using jQuery and using the ajax function, what causes it to use the error
Using jQuery Autocomplete, according to the docs you have to do the following to

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.