Working with XHR: response

PHOTO EMBED

Wed Apr 23 2025 01:14:50 GMT+0000 (Coordinated Universal Time)

Saved by @signup

const xhr = new XMLHttpRequest();
xhr.open("GET", "https://jsonplaceholder.typicode.com/posts/1");
xhr.onreadystatechange = function () {
    if (xhr.readyState === 4 && xhr.status === 200) {
        console.log("XHR Response:", JSON.parse(xhr.responseText));
    }
};
xhr.send();
content_copyCOPY

https://chatgpt.com/share/6806eb90-bdac-800e-8a25-6ffb72f6bc0e