Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript AJAX Basics (retiring) AJAX Concepts A Simple AJAX Example

XHRHttpRequest Not Updating My HTML

Hi guys,

I can't seem to reproduce the result that Dave has in this video. I've pored over my code and I can't see any error, but when I try previewing it nothing happens.

I opened the JavaScript console in Chrome and checked the Log XMLHttpRequests which shows "XHR finished loading".

The only issue that I can think of is the log is showing a different URL for the "GET" request to that which is showing in my workspace. i.e., it shows the URL of the preview window with "/sidebar.html" appended, rather than the URL of the workspace which is housing my files.

My code snippet is here: https://w.trhou.se/7qoff3cu6v

Any help would be greatly appreciated.

Cheers Don :-)

1 Answer

jag
jag
18,266 Points
// Line 12
if (xhr.readyState == 4) {

// The S in State has to be capitalized

// xhr.readystate - invalid

// xhr.readyState - valid

Schoolboy error!! :-p

Thanks for the help :-)