function ajax({
url,
method = "get",
success
}){
var xhr = new XMLHttpRequest();
xhr.open(method,url,true);
xhr.send();
xhr.onreadystatechange = function(){
if(xhr.readyState == 4 && xhr.status == 200){
var result = JSON.parse(xhr.responseText);
success(result)
}
}
}