I've been looking for information on how I can send a client side variable to the server side using JavaScript. I'm a beginner and working on my first full stack web app and essentially i want to do something like this;
var userInput = $('#location-city').val();
This is taking in the value of a <input id="location-city">
in my html file on the client side.
I want to send this variable userInput
to the server side where I use it with an API in the following manner:
baseUrl + userInput
This would add the userInput
(which would be a city) to the baseUrl
of my API and then return locations in a certain city. The reason why my API needs to stay on server side is because I'm using secret id's and tokens.