pp_01
8 years agoMentor
Using freemarker for getting a URL (reading JSON) from a local JSON asset.
Hi. I'm new in freemarker and I'm facing some issues while using it in a page I'm creating. I am trying to use a select element in my page and the functionality I want is that whenever a user clicks on any of the countries from that dropdown it should take the URL from the JSON in which I have a key and value, "country" and "URL" for that country respectively and it should open to a new page for the specific country. I have tried to do this through Javascript and it's working but I'm not getting the proper freemarker needed for this. Let's suppose the JSON I'm using is this -
"countries": [ { "name": "Argentina", "url": "https://argentina/events/" }, { "name": "Australia", "url": "https://australia/events/" } ]
What are the required things to be done for getting this functionality? If any one can help that would be awesome. Thanks in advance.