<body>
<script>
function ajaxGet(url, params = '') {
var xhr = new XMLHttpRequest();
xhr.open('get', url + "?" + params);
xhr.send();
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
let res = JSON.parse(xhr.responseText);
}
}
}
function ajaxPost(url, query = '') {
var xhr = new XMLHttpRequest();
xhr.open('post', url);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.send(query);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
let res = JSON.parse(xhr.responseText);
}
}
}