jQuery-ajax call: async property is not working?

Posted by user269386 on Stack Overflow See other posts from Stack Overflow or by user269386
Published on 2010-06-14T07:25:29Z Indexed on 2010/06/14 7:42 UTC
Read the original article Hit count: 238

Filed under:
|
|
|

Hi,

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

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery