Skip to content

43장 Ajax #45

@humonnom

Description

@humonnom
const xhr = new XMLHttpRequest();
xhr.open('GET', 'https://jsonplaceholder.typicode.com/todos/1');
xhr.send();
xhr.onload = () => {
    // HTTP 요청이 성공적으로 완료된 경우에만 발생
    if (xhr.status === 200){
        console.log(JSON.parse(xhr.response));
    } else {
        console.log('Error', xhr.status, xhr.statusText);
    }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions