freeCodeCamp / curriculum

The freeCodeCamp curriculum and lesson editor
Creative Commons Attribution Share Alike 4.0 International
81 stars 124 forks source link

Missing code in "JSON APIs and Ajax: Post Data with the JavaScript XMLHttpRequest Method" #311

Open devragj opened 5 years ago

devragj commented 5 years ago

Describe the bug

In the sample code provided in the lesson, the variable url is not defined. So, though copying and pasting the sample code passes the tests, the code does not work as intended.
The variable url should be defined and hold the path to the server.

To Reproduce

  1. Copy and past the sample code from the lesson into the code window, below the comment // Add your code below this line.
  2. Click on "Run the Tests".
  3. Close the popup with the check mark.
  4. Enter your name into the textbox on the right, and click Send Message.

Expected behavior

(From the lesson) Your AJAX function will replace "Reply from Server will be here." with the reply of the server. In this case, it is your name appended with " loves cats".

Actual Behavior

Instead, nothing happens. A quick trip to the console shows the reason. The variable url is not defined.
So, nothing is sent to the server.