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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:38:02+00:00 2026-05-26T19:38:02+00:00

I have the following function which uses the old Bassistance autocomplete: $(‘#searchLocation’).autocomplete(/Utils.aspx, { dataType:

  • 0

I have the following function which uses the old Bassistance autocomplete:

    $('#searchLocation').autocomplete("/Utils.aspx", {
        dataType: 'json',
        minChars: 2,
        selectFirst: false,
        parse: function (data) {
            var rows = new Array();
            for (var i = 0; i < data.length; i++) {
                rows[i] = { data:data[i], value:data[i], result:data[i] };
            }
            return rows;
        },
        formatItem: function (row, i, n) {
            return row;
        }
    });

The above just works i.e. the LI’s are generated for each result and a drop down list is produced directly below the input $(‘#searchLocation’).

I need to migrate to the new jQuery UI autocomplete, and I have the following so far:

$("#searchLocation").autocomplete({
        source: function( request, response ) {
            var area = $("#searchLocation").val();
            $.ajax({
                url: "/Utils.aspx",
                dataType: "json",
                data: {'q':area},
                success: function (data) {
                    console.log(data);
                    var rows = new Array();
                    for (var i = 0; i < data.length; i++) {
                        rows[i] = { data:data[i], value:data[i], result:data[i] };
                    }
                    return rows;
                }
            });
        },
        minLength: 2
    });

The data / JSON comes through as:

["CM23 ","CM23 1 ","CM23 2 ","CM23 3 ","CM23 4 ","CM23 5 "]

However, the UL is not being filled with the LI’s. There’s no error – it just doesn’t work.

What am I missing – do I need to write the code that creates the LI’s? I tried the following but it doesn’t work:

    .data( "autocomplete" )._renderItem = function( ul, item ) {
        return $( "<li></li>" )
        .data( "item.autocomplete", item )
        .append( "<a>" + row + "</a>" )
        .appendTo( ul );
    }; 

Any help would be fantastic.

  • 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-26T19:38:03+00:00Added an answer on May 26, 2026 at 7:38 pm

    Since your remote method returns data in an array of strings, the following should work just fine (no post-processing necessary):

    $("#searchLocation").autocomplete({
            source: function( request, response ) {
                $.ajax({
                    url: "/Utils.aspx",
                    dataType: "json",
                    data: {'q':request.term},
                    success: response
                });
            },
            minLength: 2
    });
    

    The key is calling the passed response function in your AJAX success method (since you don’t need any post-processing, you can use the response function as your AJAX success method directly).

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

Sidebar

Related Questions

I have the following code, in which Boost.Local uses a function callback to load
I have the following code, which uses the eval function: lines = self.fulltext.splitlines() CURRENT
I have the following line in my main() function (which uses EasyBMP): RGBApixel *
I have the following javascript function, which uses .append from JQuery. However it only
I have the following slider code which uses Mootools: window.addEvent('domready', function () { //
I have the following function which accepts text and a word count and if
I have the following function which sets up the GUI. public void go() {
I have the following function which works very well within a $(document).ready(function(){ $('.threadWrapper >
I have the following function which creates a std::vector of iterators into another container:
I have the following function in a PHP script, which returns and API call:

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.