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 Parsing JSON Data

Marcell Ciszek
Marcell Ciszek
7,255 Points

double quotes in AJAX

Is it only double quotes that is available when using AJAX?

1 Answer

Hi Marcell Ciszek ,

You can use single or double quotes when using AJAX.

An example you can run in the console right now that uses double and single quotes will show you it works either way.

// Create XML HTTP Request Object
var xhr = new XMLHttpRequest();

// Open the request with single or double quotes used.
xhr.open("GET", 'https://teamtreehouse.com/rossking.json', false);

// Send the request
xhr.send();

// Log the request
console.log(xhr.responseText)