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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:49:45+00:00 2026-06-07T14:49:45+00:00

I use the following to catch an unauthorized access and force a login: $.ajaxSetup({

  • 0

I use the following to catch an unauthorized access and force a login:

$.ajaxSetup({
    statusCode: {
        401: function(){
            //do stuff
        }
    }
});

Works great… when accessing resources on my servers (domain), but now I’m attempting to use 3rd party API resources via ajax calls and their 401’s are caught by this as well. So, how might I either:

  1. rewrite the above code to only catch 401’s from my domain, or
  2. make an $.ajax() call with an exception to the above code (use a different error handler)

Thanks much!

  • 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-07T14:49:48+00:00Added an answer on June 7, 2026 at 2:49 pm

    Through experimentation I discovered the answer. $.ajaxSetup() basically sets a default for any $.ajax() requests. However, the global setup can be overridden for a specific request like so:

    $.ajaxSetup({
        statusCode: {
            401: function(){
                //this will catch any and all access denied errors
            }
        }
    });
    
    $.ajax({
        type: 'GET',
        dataType: 'json',
        url: someresouceurl,
        statusCode: {
            401: function(){
                //except this one!
            }
        },
        success: function(data) {
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use the following code for transaction in Zend Framework but the rollback function
I want to use the following code to access the state of the keyboard
I use the following function to retrieve a contact's photo in Android where the
I want to get all ContentControls of a Word-Document. Currently I use following function
In a multi-threaded application, I use the following ASSERT macro to catch coding and
I use the following code to access a VSS item: Dim sItem As String
I use the following function for insert the value in database through the stored
I use following style attribute so when i will start typing in text box
I use following code: Create a retry policy, when error, retry after 1 second,
I just use following code to add an image to my project, var paper

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.