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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:44:55+00:00 2026-06-02T14:44:55+00:00

I am using Jquery autocomple with remote datasource, but, sometimes when try do search

  • 0

I am using Jquery autocomple with remote datasource, but, sometimes when try do search in my server a error is returned , because I’m using a rest webservice like datasource.
I’d like to know what returned status code by my webservice and print a error message
Example:

$(idObjeto).autocomplete({
            source:url,
            minLength: 3,
            select:function(data,ui){
                $(formatIdJQuery(idObjValueReceptor)).val(ui.item.id);
            }
        }).data( "autocomplete" )._renderItem = function( ul, item ) {
        return $( "<li></li>" )
            .data( "item.autocomplete", item )
            .append( "<a>" + item.label + " - <strong>" + item.id + "</strong></a>" )
            .appendTo( ul );
        };
    }

Suppose what my webservice returned status code 404, I’d like to get this status code and call alert window, for example.

That’s all folks!

  • 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-02T14:44:57+00:00Added an answer on June 2, 2026 at 2:44 pm

    You could re-structure your widget to use a function as the source parameter, then make the AJAX request yourself and do whatever you’d like upon an error:

    $(idObjeto).autocomplete({
        source: function (request, response) {
            $.ajax({
                url: url,
                dataType: "json",
                data: request,
                success: function (data) {
                    response(data);
                },
                error: function () {
                    response([]); // send no results to the widget.
                    alert("an error occurred!");
                }
            });
        },
        minLength: 3,
        select:function(data,ui){
            $(formatIdJQuery(idObjValueReceptor)).val(ui.item.id);
        }
    }).data( "autocomplete" )._renderItem = function( ul, item ) {
        return $( "<li></li>" )
            .data( "item.autocomplete", item )
            .append( "<a>" + item.label + " - <strong>" + item.id + "</strong></a>" )
            .appendTo( ul );
        };
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using 'rails3-jquery-autocomplete' gem, but it doesn't have multi column search, but there is
I'm using jQuery UI autocomplete with data from a remote datasource. My use case
I'm trying to write a simple search server, using Django with AJAX. The server
Im trying to implement an asp.net textbox using the jQuery UI Autocomplete widget http://jqueryui.com/demos/autocomplete/#remote
I am using jQuery autocomplete which is working fine with existing element but not
Im using jquery autocomplete can I pass extraParams to webservice in asp.net ? and
I am using jQuery Autocomplete to search a local database of cities. Here is
I have a test server with a page using jquery autocomplete. The autocomplete feature
I am using jQuery Autocomplete with JSON but the resulting data is not displaying
I am using jquery autocomplete combobox and everything is ok. But I also want

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.