I have a question.
How to change the ajax function so that it returns the value of output variable.
function ajax(url, data)
{
const http = new XMLHttpRequest();
http.open('post', url, true);
http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
http.onload = function()
{
if(http.status === 200 || http.status == 0)
{
var output = http.responseText;
}
}
http.send(data);
// return the value of output
}