I'm creating a website for a uni project. We're using javalin, html and css ONLY. What I'm trying to do is to display a webpage which has content that changes based on what link the user pressed. For example, if a user presses on the 'US' link, a webpage with the title US and the related data pops up. While if he chooses 'MEXICO', a webpage with the title MEXICO and the related data pops up. If you are not able to provide the code, please inform me about the implementation method.
Asked
Active
Viewed 344 times
1 Answers
-2
You can create multiple HTML pages for that, like one for the US and one for Mexico. Then, link those pages with the main page using anchor tags. e.g:
In index.html:
<a href="./mexico.html">Mexico</a>

Ibrahim Rehman
- 135
- 9
-
theres like 200 different countries this wont work for me :/ – omar Jun 03 '21 at 09:45
-
Oh I thought you were considering only a few countries – Ibrahim Rehman Jun 03 '21 at 12:41
-
Well, in this case, I think you have to use a public API to get countries data in your backend, then serve it conditionally to your frontend – Ibrahim Rehman Jun 03 '21 at 12:44
-
Like this one: `https://api.first.org/data/v1/countries` – Ibrahim Rehman Jun 03 '21 at 12:45
-
Hm. Since OP stated they only use HTML and CSS for the frontend, JavaScript's out of scope here, hence no API calls. What about links to URLs with query parameters, like `/country?code=MX`? – Alexander Leithner Jun 03 '21 at 18:46