Forum Discussion

Gursimrat's avatar
Gursimrat
Leader
11 years ago

Can I use javascript variable in freemarker

Can I? I read some where that FTL is executed before the JS, so it is not possible?

  • JasonL's avatar
    JasonL
    Lithium Alumni (Retired)

    Gursimrat wrote:

    Can I? I read some where that FTL is executed before the JS, so it is not possible?


    Hi Gursimrat,

    It's not possible - freemarker templates are processed on the server-side first, before the page gets loaded on client-side

    (javascript code gets executed only after the page is loaded in client-side browser)

    --Jason

  • AdamN's avatar
    AdamN
    Khoros Oracle

    What kind of data are you trying to get through JavaScript? Perhaps there's another approach that could be used via Freemarker.

    • Gursimrat's avatar
      Gursimrat
      Leader

      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.