Since you need this behavior in the unload event, you will have to make a synchronous call instead. However it may freeze the browser window/tab dependent on how long the call will take, but because you’re effectively trying to prevent the user from closing the window…
Add async: false
to your JSON to make a synchronous call.
Related Contents:
- Ajax request returns 200 OK, but an error event is fired instead of success
- jQuery UI ” $(“#datepicker”).datepicker is not a function”
- Unexpected Caching of AJAX results in IE8
- Pass Multiple Parameters to jQuery ajax call
- How do you get JavaScript/jQuery Intellisense Working in Visual Studio 2008?
- ASP.Net Master Page and File path issues
- How can I determine the element type of a matched element in jQuery?
- How do I run different versions of jQuery on the same page?
- How can I run some javascript after an update panel refreshes?
- How to use jQuery to call an ASP.NET web service?
- Using jQuery for AJAX with ASP.NET Webforms [closed]
- How to stop ASP.NET from changing IDs in order to use jQuery
- What does .d in JSON mean?
- Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server.”
- Access Control Request Headers, is added to header in AJAX request with jQuery
- JavaScript/jQuery to download file via POST with JSON data
- how to bypass Access-Control-Allow-Origin?
- Ajax success event not working
- include antiforgerytoken in ajax post ASP.NET MVC
- How can I validate google reCAPTCHA v2 using javascript/jQuery?
- Differences between contentType and dataType in jQuery ajax function
- TypeError: $(…).DataTable is not a function
- How to do a Jquery Callback after form submit?
- jQuery has deprecated synchronous XMLHTTPRequest
- change url without redirecting using javascript [duplicate]
- ‘append’ called on an object that does not implement interface FormData
- How to bind Events on Ajax loaded Content?
- Get file size before uploading
- Disable browser’s back button
- jQuery Ajax requests are getting cancelled without being sent
- Verify External Script Is Loaded
- What is limiting the # of simultaneous connections my ASP.NET application can make to a web service?
- Using HTML5 file uploads with AJAX and jQuery
- SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
- OnClick vs OnClientClick for an asp:CheckBox?
- Send JSON data with jQuery
- Is there a standard way to encode a .NET string into JavaScript string for use in MS Ajax?
- Jquery in React is not defined
- how to check confirm password field in form without reloading page
- Select2 Ajax Method Not Selecting
- Enable ASP.NET ASMX web service for HTTP POST / GET requests
- jQuery iframe load() event?
- JavaScript: Global variables after Ajax requests [duplicate]
- Is it possible to make JSON requests using Fiddler’s Request Builder?
- ASP.NET UpdatePanel Time Out
- How can I return a variable from a $.getJSON function
- My javascript is returning this error: $.ajax is not a function
- Backbone.js – id vs idAttribute vs cid
- Disabling some jQuery global Ajax event handlers for a request
- Jquery/Ajax call with timer