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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:02:49+00:00 2026-05-27T08:02:49+00:00

Jquery search by example: <script> $(function() { var availableTags = [ ActionScript, AppleScript, Asp,

  • 0

Jquery search by example:

<script>
    $(function() {
        var availableTags = [
            "ActionScript",
            "AppleScript",
            "Asp",
            "BASIC",
            "C",
            "C++",
            "Clojure",
            "COBOL",
            "ColdFusion",
            "Erlang",
            "Fortran",
            "Groovy",
            "Haskell",
            "Java",
            "JavaScript",
            "Lisp",
            "Perl",
            "PHP",
            "Python",
            "Ruby",
            "Scala",
            "Scheme"
        ];
        $("#tags").autocomplete({
            source: availableTags
        });
    });
</script>

<div class="demo">
    <div class="ui-widget">
        <label for="tags">Tags: </label>
        <input id="tags" />
    </div>
</div>
<!-- End demo -->

<div class="demo-description">
    <p>The Autocomplete widgets provides suggestions while you type into the field. Here the suggestions are tags for programming languages, give "ja" (for Java or JavaScript) a try.</p>
    <p>The datasource is a simple JavaScript array, provided to the widget using the source- option.</p>
</div>
<!-- End demo-description -->

There’s basically a variable with the autocomplete content, and that’s great and all, except I need something perhaps a little more complex. Instead of providing a list from a var/xml/sql I need to grab from an echo issued by a third party php script.

That php script will echo out the appropriate information depending on the query. i.e.: the user searches for customsearch.php?q=Lemons it will echo “Pineapples”.

Can someone help 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-05-27T08:02:50+00:00Added an answer on May 27, 2026 at 8:02 am

    Based on your other question, I’d assume you’re making an AJAX call to get the search results. Load them into an array and replace it in your example:

    <script>
    function GetSearchResults(){
        // make your ajax call here
        $.ajax({
          async: false,
          url: 'customsearch.php?q=Lemons',
          success: function(data) {
            var availableTags = [];
            // build an array from the response data here
            $( "#tags" ).autocomplete({
                source: availableTags
            });
          }
        });
    }
    
    $(function() {
        var availableTags = GetSearchResults();
    });
    </script>
    
    <div class="demo">
    
    <div class="ui-widget">
    <label for="tags">Tags: </label>
    <input id="tags" />
    </div>
    
    </div><!-- End demo -->
    
    <div class="demo-description">
    <p>The Autocomplete widgets provides suggestions while you type into the field. Here the suggestions     are tags for programming languages, give "ja" (for Java or JavaScript) a try.</p>
    <p>The datasource is a simple JavaScript array, provided to the widget using the source-    option.</p>
    </div><!-- End demo-description -->
    

    Ideally you wouldn’t set async to false, but I’m trying not to make your brain explode if you aren’t familiar with callbacks.

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

Sidebar

Related Questions

How do you combine two jQuery search results? eg: var $allFoos = $('.foo'), $allBars
I need to develop a generic jQuery-based search plugin for the ASP.NET MVC application
jQuery UI Autcomplete: How can I POST the term to the search script instead
Using ASP.NET 3.5 and jQuery UI. When a user clicks the Search button, a
<link rel=stylesheet type=text/css href=jquery-ui-1.8.2.custom.css /> <script src=jquery-1.4.2.min.js type=text/javascript></script> <script src=jquery-ui-1.8.2.custom.min.js type=text/javascript></script> <body> Search: <input
I cannot target an element in jQuery. First example which works : $(document).ready(function() {
I have a jQuery search script that uses tabs for the user to define
I am designing a simple jquery live search function within a widget on a
<html> <head> <script type=text/javascript src=http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js></script> <script type=text/javascript> function insertParamIntoField(anchor, param, field) { var query
I'm using jquery.flickr-1.0.js to search flickr for images in my application. The problem i'm

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.