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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:04:19+00:00 2026-05-23T12:04:19+00:00

I have really big problem with calling JSON with jQueryUI autocomplete. I have this

  • 0

I have really big problem with calling JSON with jQueryUI autocomplete.
I have this fairly simple JS:

$(document).ready(function() {
    $('#Editor_Tags').autocomplete({
        source: "/Forums/Ajax/GetTags",
        focus: function () {
            // prevent value inserted on focus
            return false;
        },
        select: function (event, ui) {
            var terms = split(this.value);
            // remove the current input
            terms.pop();
            // add the selected item
            terms.push(ui.TagName);
            // add placeholder to get the comma-and-space at the end
            terms.push("");
            this.value = terms.join(", ");
            return false;
        }
    });
});

And this is model I’m trying to return:

public class TagView
{
    public int TagId { get; set; }
    public string TagName { get; set; }
    public int Weight { get; set; }
}

But that’s not the main issue.
Main issue is, When I start typing, jQuery do not make request to controller. I’m 100% sure, that the Url speciefied is good. Because I can manually access to controller by typing /Forums/Ajax/GetTags?term=text
And I get results for it.
I’m using newset version of jQuery and jQUI directly rom google CDN.

  • 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-23T12:04:20+00:00Added an answer on May 23, 2026 at 12:04 pm

    The jQueryUI autocomplete widget expects data in the source parameter to meet the following requirements:

    [..] a simple Array of Strings, or it
    contains Objects for each item in the
    array, with either a label or value
    property or both.

    So you have two options:

    1. Change the viewmodel you’re serializing to JSON to meet those requirements:

      public class TagView
      {
          public string Label { get; set; }
          public string Value { get; set; }
      }
      
    2. Change the autocomplete widget’s source parameter to be a function in which you perform the AJAX call yourself and format the data appropriately:

      $("#Editor_Tags").autocomplete({
          source: function (request, response) {
              $.getJSON("/Forums/Ajax/GetTags", { term: request.term }, function (data) {
                  response($.map(data, function (el) {
                      return {
                          label: el.TagName,
                          value: el.TagId
                      };
                  }));
              });
          },
          /* other autocomplete options */
      });
      

      This is assuming that the data returned from the server is a JSON array of TagView objects.

    The second piece of code is untested, but it should at least get you in the right direction.

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

Sidebar

Related Questions

I have I really big problem in this website http://emprego.xtreemhost.com/log/emprego.php To see the problem
I really seem to have a big problem here. I'm using MySQL to store
I have a really big database (running on PostgreSQL) containing a lot of tables
I have a database full of customer data. It's so big that it's really
I have a really simple search form with the following Label (Search) Textbox (fixed
Good day, Stackoverflow! I have a little (big) problem with porting one of my
I'm a bit worried about performance issue when calling RegEx.Replace to really big amount
My problem seems to be really simple but I just can't get the reason
I have some really big application mixture of c# and j#. Sometimes when I
I've got a really big problem with my image storage server. There are about

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.