mirror of
https://github.com/kleeja-official/kleeja.git
synced 2026-01-16 03:02:03 +01:00
17 lines
484 B
JavaScript
17 lines
484 B
JavaScript
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);
|
|
}
|
|
};
|
|
xhttp.open(method, url, true);
|
|
if (method == 'POST') {
|
|
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
|
sendData = data;
|
|
}
|
|
xhttp.send(sendData);
|
|
}
|