Forum Discussion
What kind of data are you trying to get through JavaScript? Perhaps there's another approach that could be used via Freemarker.
We are creating a search, where we are reading the parameter from the URL, can we feed that to FTL? That is, whatever the user searches, in a custom search.
- JasonL11 years agoLithium Alumni (Retired)
Gursimrat wrote:
We are creating a search, where we are reading the parameter from the URL, can we feed that to FTL? That is, whatever the user searches, in a custom search.
have you tried this?
http.request.parameters.name.get("parameter_name", default_value)
9.1.0 Returns a parameter set on the request, or the default value specified if the request parameter is not found.
Example
${http.request.parameters.name.get("page", 1)}
Ref:
- sunny_mody11 years agoAdvisor
if you want to use your javascript variable into freemarker, then probably you should use the endpoint feature
Create an endpoint
Try hitting an ajax call to an endpoint with the desired variable as query parameter
Fetch the parameter in endpoint and use it into your freemarker over there. (The freemarker code that you wanted to use now should be in your endpoint)
Hope this workaround might help you.
Related Content
- 4 years ago
- 13 years agoInactive User