From 836a35d0dd88bd4c943b53aea225c689403a4b95 Mon Sep 17 00:00:00 2001 From: Eric Espie Date: Tue, 12 Oct 2021 08:55:40 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B04352=20-=20Fix=20unlock=20message?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/forms-json-utils.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/js/forms-json-utils.js b/js/forms-json-utils.js index 84ed4904b..92b8b3a97 100644 --- a/js/forms-json-utils.js +++ b/js/forms-json-utils.js @@ -112,13 +112,14 @@ function OnUnload(sTransactionId, sObjClass, iObjKey, sToken) if (!window.bInSubmit) { // If it's not a submit, then it's a "cancel" (Pressing the Cancel button, closing the window, using the back button...) - // IMPORTANT: the ajax request MUST BE synchronous to be executed in this context - $.ajax({ - url: GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', - async: false, - method: 'POST', - data: {operation: 'on_form_cancel', transaction_id: sTransactionId, obj_class: sObjClass, obj_key: iObjKey, token: sToken } - }); + var sUrl = GetAbsoluteUrlAppRoot()+'pages/ajax.render.php'; + var oFormData = new FormData(); + oFormData.append('operation', 'on_form_cancel'); + oFormData.append('transaction_id', sTransactionId); + oFormData.append('obj_class', sObjClass); + oFormData.append('obj_key', iObjKey); + oFormData.append('token', sToken); + navigator.sendBeacon(sUrl, oFormData); } }