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

Tyler Barnes
Tyler Barnes
1,464 Points

XHR finished loading: GET "http://port-80-ss1nh4igdr.treehouse-app.com/sidebar.html". yet nothing changes in browser!

I've looked back and forth between my code and the video over and over trying to find a typo or miscapitalization error but I can't find anything. console is saying its loaded sidebar.html but I can't see it showing up in the browser.

var xhr = new XMLHttpRequest();
    xhr.onreadystatechange = function () {
      if (xhr.readyState === 4) {
        document.getElementById('ajax').innerHtml = xhr.responseText;
      }
    };
    xhr.open('GET', 'sidebar.html');
    xhr.send();

2 Answers

Tiffany McAllister
Tiffany McAllister
25,806 Points

JavaScript is case sensitive so try changing 'innerHtml' to 'innerHTML' and see if that works.

Tyler Barnes
Tyler Barnes
1,464 Points

I actually figured that out right after posting my question but couldn't figure out how to go back to the question. Thank you though!

Tiffany McAllister
Tiffany McAllister
25,806 Points

No problem! Glad you got it figured out :)