From d8baf915e1e4f361ed83030cc673e165f7eb5b7e Mon Sep 17 00:00:00 2001 From: MitanOmar Date: Sun, 24 May 2020 18:21:34 +0200 Subject: [PATCH] refactore --- styles/bootstrap/js/script.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/styles/bootstrap/js/script.js b/styles/bootstrap/js/script.js index 479b47a..dfdc78b 100644 --- a/styles/bootstrap/js/script.js +++ b/styles/bootstrap/js/script.js @@ -1,6 +1,7 @@ function ajaxRemote (method, url, data, successCallback) { var xhttp = new XMLHttpRequest(); + let sendData = null; xhttp.onreadystatechange = function () { if (this.readyState == 4 && this.status == 200) { successCallback(this); @@ -9,7 +10,7 @@ function ajaxRemote (method, url, data, successCallback) xhttp.open(method, url, true); if (method == 'POST') { xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + sendData = data; } - let sendData = method == 'POST' ? data : null xhttp.send(sendData); }