refactore

This commit is contained in:
MitanOmar
2020-05-24 18:21:34 +02:00
parent 2f27d8354d
commit d8baf915e1

View File

@@ -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);
}