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

Ross King
Ross King
18,521 Points

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)