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) Programming AJAX Processing JSON Data

"let statusHTML=" did not work

I tried with the let keyword, the widget didn't show up and it gave me this error: "Uncaught ReferenceError: statusHTML is not defined".
Then I used var, it works, but there's still an error: "Uncaught TypeError: Cannot set property 'innerHTML' of null" What am I missing?

2 Answers

Somehow it worked the next day, maybe VS Code needed a restart. Thanks for the answer!

Steven Parker
Steven Parker
229,732 Points

Viktor Rozgonyi — Glad to help, but normally you'd mark the answer that helped you as "best answer". :wink:

Steven Parker
Steven Parker
229,732 Points

The problem causing "Uncaught TypeError: Cannot set property 'innerHTML' of null" is that the code on left side of that assignment is not finding the element.

To be able to pin it down more specifically, we'd need to see the actual code, preferably in a workspace snapshot.