XHR issue in a local file

var request = new XMLHttpRequest();
request.open('GET', 'data.txt');
request.onReadyStateChange = function() {
	if (request.status===200) {

index.html →

<!DOCTYPE html>
<html lang="en">
	<meta charset="utf-8" />
	<title>JavaScript AJAX</title>
<script src="script.js"></script>

But nothing is outputting →

Hi @codeispoetry, you can get more details about the request (status code etc.) in the network tab of the browser dev tools (should be somewhere next to Console and Sources).

1 Like

Hi @m3g4p0p

All seems good →

Ah, onreadystatechange is written all lower case.

1 Like

Thanks sir, it worked.

1 Like