javascript - jQuery-ajax call: async property is not working? -
Some conditions are given, I have to be forced to put page settings (JavaScript-value) in session and it Should be corrected before leaving the page (I can not use cookies, because "Page settings" can be quite large and local storage is not yet an option;)) So in this way I tried to do it though, it seems that when I call the page directly, the "asynchronous" call is done, even though the async-attribute (I do not get the settings of the previous call, But before that the situation is not obtained):
$ jq (document) .ready (function () {$ jq (window). Unload (main .__ setSessionValues);}); Var main = {page settings: {}, __setSessionValues: function __setSessionValues () {$ jQ.ajax ({type: "POST", async: false, url: "http://blabla.com/bla", data : {Page settings: Object.toJSON (Main.pageSettings)}}); }}; Do anyone know what the problem might be?
you can try to
Preloaded ", ...) instead of
unload
, drag things as soon as possible. But of course, if something else also hides frombeforeunload
and the unload is canceled, your call will also be made, even if you are still on the page.A little distant topic, but if you can meet this in a different way, then when I'm trying to leave the page, Firefox does not have to close synchronous ajax call.
Comments
Post a Comment