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

  • Home
  • SEARCH
  • 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 997099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:58:42+00:00 2026-05-16T06:58:42+00:00

So I already have the website working (I’m not working from scratch). The problem

  • 0

So I already have the website working (I’m not working from scratch). The problem I have is that a lot of the content is available only if you’re logged in (pretty much everything). So sometimes I have a modal popup which retrieved (using ajax) something to display.

In my server side code, if someone’s not logged in, they are redirected to the sign-in page.

This produces a strange effect, as if someone is on a page and is no longer logged in, then the modal that pops up tries to display the sign in page.

What possibilities are there for straightening this out?

The only thing I can think of is having a url that checks if they’re logged in and returns that, and along with every ajax request, I could check if they’re logged in or not and the Javascript could act accordingly.

I’m hoping there’s some other possibilities.

  • 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-16T06:58:42+00:00Added an answer on May 16, 2026 at 6:58 am

    I’ve solved it like this.

    1. On server side, process authentication error differently depending on whether request is ajax or not. In first case – return 401 ‘unauthenticated’ response, in second – redirect to sign-in page.
    2. On client side, register common jquery ajax error handler to catch 401 errors and redirect user to login page.

      $.ajaxSetup({
          error: function(event, request, options, error) {
              switch (event.status) {
                  case 401: common.setLocation('/sign-in'); break;
                  ...
              }
          }
      });
      

    It’s quite simple solution, you don’t even have to modify each particular request, so hope it helps.

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

Sidebar

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.