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 AJAX Concepts A Simple AJAX Example

David Palmer
David Palmer
5,453 Points

Uncaught SyntaxError: Unexpected Identifier

Hello: In AJAX Basics – A Simple AJAX Example Workspace, executing the ‘example1.html gives the following errors in the console log: Uncaught SyntaxError: Unexpected Identifier (Index):11 Uncaught ReferenceError: sendAJAX is not defined at HTMLButtonElement.onclick ((Index):31)

Please advise.

Thanks!

Can you post a snapshot? Click the camera icon in the upper right corner, then 'Take Snapshot', then post the link created here. If not can you post the code? Also it seems like you are talking about example2.html as that is the file with the button.

1 Answer

I got the same error. But, I'm not sure what is wrong. Here is a snapshot: https://w.trhou.se/kxycpzkz4l

Mark Wilkowske
Mark Wilkowske
Courses Plus Student 18,131 Points

Hi Jamela, fixing these two errors will make you code work.

  1. Line 12 the if statement is open because it needs the closing }
  2. On line 18 the style property value should use single quotes --> style.display = 'none';