function fetchData(url, callback) {
const xhr = new XMLHttpRequest();
xhr.open("GET", url, true);
xhr.onload = function () {
if (xhr.readyState === 4 && xhr.status === 200) {
callback(xhr.responseText);
}
};
xhr.send();
}
fetchData("https://jsonplaceholder.typicode.com/posts/1", function (data) {
console.log(data);
});