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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:08:23+00:00 2026-06-11T05:08:23+00:00

Possible Duplicate: jquery autocomplete this.source is not a function error I have an autocomplete

  • 0

Possible Duplicate:
jquery autocomplete this.source is not a function error

I have an autocomplete which I want to hook upto my API to return all customer account numbers. The problem is my API returns an object: AccountNumber, InvoiceNumber, Name, Address etc.. When I try to make my source the AccountNumber only, like below:

$.getJSON('/api/Customers', function(data) {
    $("#AccountNumber").autocomplete({
        source: data.AccountNumber,
        minLength: 4
    });
});

I get back this error:

Uncaught TypeError: Property 'source' of object #<Object> is not a function

Any ideas what Im doing wrong here?

  • 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-11T05:08:25+00:00Added an answer on June 11, 2026 at 5:08 am

    Since the callback is returning an Object, you must pull the data and place it in an arary. As long as data is an array of Account Objects, you could try this:

    $.getJSON('/api/Customers', function(data) {
        var acctNums = [];
        for(a in data) {
            acctNums.push(data[a].AccountNumber);
        }   
    
        $("#AccountNumber").autocomplete({
            source: acctNums,
            minLength: 4
        });
    });
    

    Another option would be to just add a different Request route that would only return an array of customer account numbers. That way you can just pass it as such:

    $.getJSON('/api/Customers/AccountNums', function(data) {
        $("#AccountNumber").autocomplete({
            source: data,
            minLength: 4
        });
    });
    

    Finally, you could let the jQuery UI plugin handle the calls. You’ll need to create a different request route that returns an array of JSON objects only for Autocomplete (each contain value and label properties). Then just use the absolute or relative URL of your route to get the data. Below is a small example:

    $("#AccountNumber").autocomplete({
        // This GET Request returns an Array of Objects used for Auto-Complete:
        // [ { label: "Choice1", value: "value1" }, ... ]
        source: '/api/Customers/AccountNumsAuto',
        minLength: 4
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: jQuery get all divs which do not have class attribute I need
Possible Duplicate: Bind multiple events to jQuery 'live' method I have the following function:
Possible Duplicate: jQuery - is it bad to have multiple $(document).ready(function() {}); Can you
Possible Duplicate: jquery trigger - ‘change’ function I have a radio button set called
Possible Duplicate: jQuery .load method not firing on IE9 In IE7 and IE8 this
Possible Duplicate: jQuery: Return data after ajax call success I have the following function
Possible Duplicate: jQuery: How to determine which <li> tag was clicked? I have a
Possible Duplicate: jQuery - is it bad to have multiple $(document).ready(function() {}); Can you
Possible Duplicate: jQuery ajax error function I am trying to replace a global ajax
Possible Duplicate: jQuery: how do I animate a div rotation? I have a div

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.