function newPost(url, data, success) {
fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json;charset=UTF-8',
},
body: JSON.stringify(data),
credentials: 'include'
}).then(res => res.text())
.then(text => {
if (success) {
success(text)
}
});
}
function oldPost(url,data, success){
var async2 = true;
var method = "POST";
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var text = xmlhttp.responseText;
if(success){
success(text)
}
}
}
xmlhttp.open(method, url, async2);
xmlhttp.setRequestHeader("Content-type", "application/json;charset=UTF-8");
xmlhttp.send(JSON.stringify(data));
}