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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:30:05+00:00 2026-05-31T13:30:05+00:00

I am attempting to use a remote service to populate an autocomplete field that

  • 0

I am attempting to use a remote service to populate an autocomplete field that I have in rails. It is supposed to query and return available employees by last name

I have an action in my controller called employeeAutocomplete which gathers data from an outside database:

class ServicesController < ApplicationController
 def employeeAutocomplete
  @banner = employeeSearch(params[:term])
  respond_to do |format|
    format.json { render :json => @banner.to_json }
  end
 end

In my routes.rb I have a placeholder route:

match '/banner/cheese' => 'services#employeeAutocomplete'

I can successfully browse to http://0.0.0.0:3000/banner/cheese.json?term=mac and receive an array such as the following with employee data:

[ {"LAST_NAME": "MacDougal", "FIRST_NAME": "Elaine", "TITLE": "Internet Technician"}, {"LAST_NAME": "MacCallum", "FIRST_NAME": "Harvey", "TITLE": "Systems Architect"} ]

However, this does not work with the autocomplete field. Here’s the javascript for my view:

$("#service_employeeLast").autocomplete({
    source: "/banner/cheese.json"
});

I receive an error in the firebug console:
I receive an error in the firebug console

I’m at wits end. I do not know what I’m doing wrong, I’ve tried two different autocomplete plugins and keep getting this same error jquery.js:8103

Help!

  • 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-31T13:30:06+00:00Added an answer on May 31, 2026 at 1:30 pm

    Believe it or not it was Google Chrome causing the issue. Apparently it dislikes localhost ajax calls. Here is the updated code working as intended:

    services.js

    $(function() {
     $( "#service_employeeLast" ).autocomplete({
        source: "/banner/fetch",
        minLength: 2,
    
     });
    });
    

    services_controller

    def employeeAutocomplete
        @banner = employeeSearch(params[:term])
        @banner_hash = []
        @banner.each do |b|
            @banner_hash << { 
                :title => b["POSITION_TITLE"], 
                :label => [b["FIRST_NAME"], b["LAST_NAME"]].join(" "), 
                :value => b["LAST_NAME"], 
            }
        end
        render :json => @banner_hash
    end
    

    The key here also that your return value hash has a label and value key/value pair

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

Sidebar

Related Questions

I have been attempting to use ASP.NET MVC remote validation for username login access
I'm attempting to use an HttpWebRequest to query a remote server running nginx. I
In attempting to use std::select1st from <functional> in a VS2008 project I found that
I'm attempting to get the content-length of a remote file so that I can
I'm attempting to use MsDeploy runCommand provider to uninstall and reinstall a Windows service
I'm attempting to use Paramiko (Python SSH library) to read a remote file, and
I'm using a remote 3rd party storage solution that does not have support for
I am attempting to use the remote data annotation for the first time in
I am attempting to use oauth API to authenticate a google service account through
I am attempting to control a service on a remote machine using the following

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.