diff --git a/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/access-the-json-data-from-an-api.english.md b/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/access-the-json-data-from-an-api.english.md index 581d3027b8..41c354be97 100644 --- a/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/access-the-json-data-from-an-api.english.md +++ b/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/access-the-json-data-from-an-api.english.md @@ -48,22 +48,22 @@ tests: ```html + +

Cat Photo Finder

The message will go here @@ -110,8 +111,60 @@ tests: ## Solution

-```js -// solution required +```html + + + + +

Cat Photo Finder

+

+ The message will go here +

+

+ +

```
diff --git a/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/change-text-with-click-events.english.md b/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/change-text-with-click-events.english.md index 22f2a67326..2fea07e968 100644 --- a/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/change-text-with-click-events.english.md +++ b/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/change-text-with-click-events.english.md @@ -37,8 +37,8 @@ tests: ```html + +

Cat Photo Finder

The message will go here @@ -92,8 +94,54 @@ tests: ## Solution

-```js -// solution required +```html + + + + +

Cat Photo Finder

+

+ The message will go here +

+

+ +

+ ```
diff --git a/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/convert-json-data-to-html.english.md b/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/convert-json-data-to-html.english.md index d4ad797c0a..410544ec47 100644 --- a/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/convert-json-data-to-html.english.md +++ b/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/convert-json-data-to-html.english.md @@ -14,8 +14,9 @@ Then, loop through the JSON, adding HTML to the variable that wraps the key name Here's the code that does this: ```js +let html = ""; json.forEach(function(val) { - var keys = Object.keys(val); + const keys = Object.keys(val); html += "
"; keys.forEach(function(key) { html += "" + key + ": " + val[key] + "
"; @@ -68,24 +69,24 @@ tests: ```html + +

Cat Photo Finder

The message will go here @@ -125,15 +127,73 @@ tests:

- - ## Solution
-```js -// solution required +```html + + + + +

Cat Photo Finder

+

+ The message will go here +

+

+ +

```
diff --git a/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/get-geolocation-data-to-find-a-users-gps-coordinates.english.md b/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/get-geolocation-data-to-find-a-users-gps-coordinates.english.md index d69597c827..bba3fbf685 100644 --- a/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/get-geolocation-data-to-find-a-users-gps-coordinates.english.md +++ b/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/get-geolocation-data-to-find-a-users-gps-coordinates.english.md @@ -74,8 +74,19 @@ tests: ## Solution
-```js -// solution required -``` +```html + +

You are here:

+
+ +
diff --git a/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/get-json-with-the-javascript-xmlhttprequest-method.english.md b/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/get-json-with-the-javascript-xmlhttprequest-method.english.md index dbf4967f53..f4e9ca9f19 100644 --- a/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/get-json-with-the-javascript-xmlhttprequest-method.english.md +++ b/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/get-json-with-the-javascript-xmlhttprequest-method.english.md @@ -16,12 +16,12 @@ However, JSON transmitted by APIs are sent as bytes, and your appli You can request the JSON from freeCodeCamp's Cat Photo API. Here's the code you can put in your click event to do this: ```js -req=new XMLHttpRequest(); +const req = new XMLHttpRequest(); req.open("GET",'/json/cats.json',true); req.send(); -req.onload=function(){ - json=JSON.parse(req.responseText); - document.getElementsByClassName('message')[0].innerHTML=JSON.stringify(json); +req.onload = function(){ + const json = JSON.parse(req.responseText); + document.getElementsByClassName('message')[0].innerHTML = JSON.stringify(json); }; ``` @@ -64,8 +64,8 @@ tests: ```html + +

Cat Photo Finder

The message will go here @@ -119,11 +121,11 @@ tests: ## Solution

-```js +```html // solution required + +

Cat Photo Finder

The message will go here diff --git a/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/handle-click-events-with-javascript-using-the-onclick-property.english.md b/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/handle-click-events-with-javascript-using-the-onclick-property.english.md index cb1181b171..3aa05de169 100644 --- a/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/handle-click-events-with-javascript-using-the-onclick-property.english.md +++ b/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/handle-click-events-with-javascript-using-the-onclick-property.english.md @@ -10,7 +10,7 @@ forumTopicId: 301503 You want your code to execute only once your page has finished loading. For that purpose, you can attach a JavaScript event to the document called DOMContentLoaded. Here's the code that does this: ```js -document.addEventListener('DOMContentLoaded',function() { +document.addEventListener('DOMContentLoaded', function() { }); ``` @@ -18,7 +18,7 @@ document.addEventListener('DOMContentLoaded',function() { You can implement event handlers that go inside of the DOMContentLoaded function. You can implement an onclick event handler which triggers when the user clicks on the element with id getMessage, by adding the following code: ```js -document.getElementById('getMessage').onclick=function(){}; +document.getElementById('getMessage').onclick = function(){}; ```

@@ -49,13 +49,14 @@ tests: ```html + +

Cat Friends

Reply from Server will be here @@ -126,7 +128,68 @@ tests:

```js -// solution required + + + + +

Cat Friends

+

+ Reply from Server will be here +

+

+ + +

```
diff --git a/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/pre-filter-json-to-get-the-data-you-need.english.md b/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/pre-filter-json-to-get-the-data-you-need.english.md index 5be13b6b61..abaf627608 100644 --- a/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/pre-filter-json-to-get-the-data-you-need.english.md +++ b/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/pre-filter-json-to-get-the-data-you-need.english.md @@ -43,14 +43,14 @@ tests: ```html + +

Cat Photo Finder

The message will go here @@ -113,8 +115,71 @@ tests: ## Solution

-```js -// solution required +```html + + + + +

Cat Photo Finder

+

+ The message will go here +

+

+ +

```
diff --git a/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/render-images-from-data-sources.english.md b/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/render-images-from-data-sources.english.md index 113003969b..58c98e3720 100644 --- a/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/render-images-from-data-sources.english.md +++ b/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/render-images-from-data-sources.english.md @@ -37,14 +37,14 @@ tests: ```html + +

Cat Photo Finder

+

+ The message will go here +

+

+ +

+ ```