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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:27:24+00:00 2026-06-03T07:27:24+00:00

When using the YUI3 Autocomplete widget with a URL source which returns JSON data,

  • 0

When using the YUI3 Autocomplete widget with a URL source which returns JSON data, is there a simple way to detect HTTP error responses?

Example:

Y.one('#ac-input').plug(Y.Plugin.AutoComplete, {
    resultHighlighter : 'phraseMatch',
    source : "http://example.com/api/item/search/?q={query}",
});

(For example, if the user hasn’t authenticated on that server, the Autocomplete widget receives a 401 response and fails silently but logs the error to the console.)

I’ve searched but haven’t found documentation specific to this issue – source diving didn’t help, either. I think I’ll have to roll my own datasource object so I can issue the request and detect the error.

Or is there a simpler way to pass an error event handler to the YUI3 Autocomplete widget for this type of data source?

Edit: See my follow-up answer for a simple solution using Y.on('io:failure').

  • 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-03T07:27:26+00:00Added an answer on June 3, 2026 at 7:27 am

    A simple solution: use a global IO failure event handler. It works without the complexity of the DataSource.IO object as described in this answer.

    While I would rather handle the error locally in the AutoComplete widget event handlers, alas, I’ve not found a simple way to do that.

    Using Y.on('io:failure') event handling may be a much more direct approach if all you need to do is display info about comms errors.

    //
    // Handle IO failure event
    function ioFailureFunction(transaction, xhrObject) {
        errCode = xhrObject.status;
        // Insert the current error status into an HTML element...
        Y.one('#error').setContent(errCode);
    };
    Y.on('io:failure', ioFailureFunction);
    

    Rationale: I’ve found that using the DataSource.IO method outlined in this answer may introduce significant complexity, so if you have simple needs, this method is expedient and works with simple AutoComplete configurations — thus you can keep your AutoComplete config simple and still handle IO errors…

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

Sidebar

Related Questions

I am trying to test a few ajax and JSON parsing examples using YUI3
I'm using models in yui3, and although there are functions like reset() and undo(),
I am using YUI 2 components in YUI3 using the standard way YAHOO has
I am dynamically loading stylesheets using YUI3 'Get'. which is working flawlessly however, as
I just started using YUI3 Test module (http://yuilibrary.com/yui/docs/test/). I have testcases with many asserts
Using PHP, I can convert MySQL data or static table data to csv, Excel,
I've got a webpage that validates as XHTML 1.0 Strict. I'm using YUI3 and
Using Android TelephonyManager an application can obtain the state of data activity over the
Using MVC2 I have an AJAX form which is posting to a bound model.
Using Delphi 2010. I am looking for (possibly) a function or procedure which can

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.