Forum Discussion

srinivaskiranp's avatar
7 years ago

Can we use Context objects in jquery

what is the way to use Lithium Context Objects in the JQuery added in <@liaAddScript>? 

  • srinivaskiranp

    You can use it in a similar way how you use is it in freemarker.

    var corenode_id = '${coreNode.id}';

    But it will through an error in the component preview. You have to test it in the frontend i.e. Forum page, category page etc.   

     

    Alternatively, you can also assign it to freemarker variable and then use it in JS

    <#assign id = coreNode.id />

    <script>

    console.log('${id}')

    </script>