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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:20:54+00:00 2026-05-26T09:20:54+00:00

I have this code: $(input#autocomplete).autocomplete({ source: [c++, java, php, coldfusion, javascript, asp, ruby] });

  • 0

I have this code:

$("input#autocomplete").autocomplete({
    source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"]
});

and it works. If I try to put anything else in there like:

$("input#autocomplete").autocomplete({
alert ("test");
    source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"]
});

then it doesn’t work and gives this error: syntax error: unexpected string.

I was hoping to make an AJAX call before the source: call so that I can get the data to display to the user. Am I misunderstanding something in how this is supposed to work?

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-26T09:20:54+00:00Added an answer on May 26, 2026 at 9:20 am

    see the autocomplete events, i think the “search” event is the one you need, here is a link http://jqueryui.com/demos/autocomplete#event-search

    here is an ajax example

    $( "#user_name" ).autocomplete({
                source: "index.php?option=abc",
                delay: 0,
                minLength: 0,
                autoFocus: true,
                select: function (event, ui) {
    
                        $("#user_id").val(ui.item.id);
                        $(this).data("user_id",ui.item.id);//Store arbitrary data associated with the specified element
                        $(this).data("username",ui.item.value);//Store arbitrary data associated with the specified element
    
                    },
                    selectFirst: true,
                    autoFill: true,
                    mustMatch: true
                })
                .bind("blur",function() {
                    var user_id = $(this).data("user_id");
                    var username = $(this).data("username");
                    if(typeof username === \'undefined\')
                    {
                        username = \'\';
                        user_id = null;
                    }
                    $(this).val(username);
                    $("#user_id").val(user_id);
                })
    
    
    ;
        });//fine autocomplete
    
    • 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: $(#auto).autocomplete({ source: js/search.php, minLength: 3 }); This code is
i have the following code : <input type=text value=<?php echo $_GET['msg']; ?>> This input
Using MATLAB, I have this code: value = input('>> Enter a value: '); and
I have this code in Python inputted = input(Enter in something: ) print(Input is
I have this HTML code for radios: <input type='radio' name='a_27' value='Yes' id='a_27_0' /> <input
I have this js code: $(#startSearch).live(click, function(event) { $(input:checkbox[name='searchId']:checked).each(function() { var searchId = $(this).val();
I have this line of code for page load: if ($(input).is(':checked')) { and it
Suppose to have a code like this: <div class=notSelected> <label>Name <input type=text name=name id=name
I have this code: chars = #some list try: indx = chars.index(chars) except ValueError:
i have an input using the jquery autocomplete plugin. with this i want 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.