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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:49:11+00:00 2026-05-15T07:49:11+00:00

given to certain circumstances, I’m forced to keep page settings (Javascript-values) in the session

  • 0

given to certain circumstances, I’m forced to keep page settings (Javascript-values) in the session and it has to be done right before leaving the page (I can’t use cookies, since “pageSettings” can become quite large and localStorage is not an option yet 😉 ). So this is how I tried it. However it seems that when I call the page directly again, the call of “http://blabla.com/bla” happens asynchronous, even though the async-attribute is set (I don’t receive the settings of the previous call, but of the one before):

$jQ(document).ready(function () {
    $jQ(window).unload(Main.__setSessionValues);
});

var Main = {
    pageSettings: {},

    __setSessionValues: function __setSessionValues() {
        $jQ.ajax({
            type: "POST",
            async: false,
            url: "http://blabla.com/bla",
            data: {
                pageSettings: Object.toJSON(Main.pageSettings)
            }
        });
    }
};

Does anyone know what the problem might be?

thanks in advance

  • 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-15T07:49:11+00:00Added an answer on May 15, 2026 at 7:49 am

    The code looks fine. You might try bind('beforeunload', ...) rather than unload, to grab things as early as possible. But of course, if something else also hooks beforeunload and the unload gets cancelled, your call will have been made even though you’re still on the page.

    Slightly off-topic, but if you can possibly find a different way to do this, I would. Firing off synchronous ajax calls when the user is trying to leave the page is not ideal.

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

Sidebar

Ask A Question

Stats

  • Questions 499k
  • Answers 499k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer State is not changed because you don't update the field… May 16, 2026 at 12:28 pm
  • Editorial Team
    Editorial Team added an answer I would not make a function to do this, just… May 16, 2026 at 12:28 pm
  • Editorial Team
    Editorial Team added an answer Your problem is probably that JSON goes through much stricter… May 16, 2026 at 12:28 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a when in JBehave which under certain circumstances should throw an exception.
Certain features for data-bound grid controls are a given and should be available in
I want to append something at the end of a certain line(have some given
Given an arbitrary python object, what's the best way to determine whether it is
Given points ABC, how could I find angle ABC? I'm making a feehand tool
Given all the options to have processes or threads interact with each other (locks,
Given an input string (will actually be an integer value) and an encryption key,
I want to create a custom malloc which allocates memory blocks within a given
In my code I default to using ArrayList for all Lists, HashMap for all
I'm using the Zemanta API, which accepts up to 8 KB of text per

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.