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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:18:59+00:00 2026-06-15T21:18:59+00:00

How to call the ajax auto complete when particular time? here this is my

  • 0

How to call the ajax auto complete when particular time?
here this is my code

function auto(x){


x.autocomplete('ajax/getFriends',{
        max:500,
        width:300,
        minChars:2,
        autoFill: false,

        formatItem: formatItem,
        formatResult: formatResult
        });

        function formatItem(row) {
                return row[0];
                //return row[0] + " (<strong>id: " + row[1] + "</strong>)";
        }
        function formatResult(row) {
            return row[0].replace(/(<.+?>)/gi, '');
        }

         $("#comment").result(function(event, data, formatted) {
            $("#test1").val(data[1]);
            $("#test2").val(data[2]);
         });
    }

but it says error x.autocomplete is not a function

i am calling the above is like

auto("string");

can any one help me how to solve this one

Thanks in advance
i am not good in english if any mistakes excuse me

  • 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-15T21:19:01+00:00Added an answer on June 15, 2026 at 9:19 pm

    I think you are confusing the way jQuery autocomplete works alltogether. It seems to me that you are attaching autocomplete to your string and building up the HTML elements for the suggestions. This is not how the autocomplete functionality works.

    What you want to do is attach the autocomplete functionality to your input box. Then whenever something is entered in there the autocomplete function fires automatically on the input. That’s just how it’s built.

    So let’s say for instance you have an input box with an ID equal to myAwesomeInputBox in your HTML code:

    <input type="text" id="myAwesomeInputBox"/>
    

    To bind autocomplete (with ajax) to this input field just do this in Javascript:

    $("#myAwesomeInputBox").autocomplete({
                    source: function( request, response ) {
    
                            // request.term is the input in the textbox, encode for security reasons
                            var input = encodeURI(request.term); 
    
                            $.ajax({
    
                                // your ajax endpoint
                                url: 'ajax/getFriends', 
    
                                // the request method, modify to your actual method
                                type: 'GET', 
    
                                // whatever data you want to pass to your endpoint. 
                                // I'm assuming at least the input (with key userInput here) 
                                // and maybe the limit of the elements in the response array 
                                // the server should send back
                                data: {userInput: input, limit: 500}, 
    
                                // what to do on success (process the response) 
                                success: function(data){ 
    
                                    // assuming your ajax endpoint returns a JSON encoded array with the suggestions as a response
                                    var responseArray = $.parseJSON(data);
    
                                    // pass the decoded response array to the jquery defined response method for autocomplete
                                    response(responseArray); 
                                }, 
    
                                // what to do if the server returns an error
                                error: function(jqXHR, textStatus, errorThrown){
                                    // pass an empty suggestions array maybe?
                                    response(new Array()); 
                                }
                              }, 'json');
                        }
                });
    

    The tricky part for me was

    response(responseArray); 
    

    but once you examine it it’s quite understandable. You’re just passing an array to the jQuery autocomplete handler for further processing.

    I’m not sure how previous versions of jQuery handled ajax autocomplete but this is how version 1.8.0 (and up) handles it.

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

Sidebar

Related Questions

i am using jquery-ui auto-complete and making a ajax call inside the auto-complete function
$(.someClassWithMultipleItemsOnDOM).autocomplete({ minLength:2, source .....(ajax call) ..... }).focus( function() { /*some code*/ }) .data( autocomplete
I want to know how to call Ajax function Recursively. My ajax code is
I am using jquery-ui autocomplete and making a ajax call inside the autocomplete function
I have this jquery call to ajax, function findTaxForProcess(argPrc, argPrcAmount, argPrcDiscount) { if (argPrc
I'm new here, and I'm having a problem with ajax autocomplete, I get this
In the code below (Coffeescript), in the AJAX call for the jQuery autocomplete data
I have a Jquery autocomplete ajax function whose source is calculated from code behind.
I call an ajax enabled wcf service method , <script type=text/javascript> function GetEmployee() {
I did ajax call and got response in callback function like below: var v=;

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.