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

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,254 Points

Question about AJAX

If you're familiar with the Workspace area you might know what I mean, I'll try to be as concise as I can.

I've just finished the video where we do our first AJAX example. I think I understand the code now but on the workspace are 3 pages.

index.html example1.html example3.html

There are 2 main differences to this code. I wanted to test example 2 by previewing it in the browser. Example 2 is the one with the "bring it" button But it kept acting as if I was requesting it to do example1.

I got round it by changing index.html to be the same as example2.html but I wondered if there was a reason for this or it might be a bug?

Can you please post a link to the video? Thanks!

1 Answer

The issue is because when you preview from the Workspace, it loads the index.html file by default. Try adding /example1.html or /example2.html to the end of the Workspace preview URL (after you've hit preview).

Then you should see the corresponding files as required. Or, you could always add hyperlinks on the index.html page with a href value of example1.html or example2.html and then follow that link so you don't have to keep changing the URL manually.

Hope that helps.