Getting Varied Responses from Server

This lesson will explain how to get a varied response from a server based on the input we send to it. This will help us build a more accurate dropdown menu in the end.

We are now at a point where we want to get different values depending on the menu item that’s active, so we want the server to give varied responses based on the data passed.

We’ll follow the following pattern: start from a blank page so that we can focus on testing functionality.

For this example, we’ll create an input, and whenever we click a button, the client will send a GET request to the server with whatever’s been typed into the input as data. The client will then append the response to a div.

Get hands-on with 1400+ tech skills courses.