Forum Discussion

Suchith's avatar
7 years ago

How to get Collection value inside javascript.

Hi, 

I want to get user collection values inside javascript. for example if i want to get user name and email in will write an html code like below:

 

<p>${user.login}</p>

<p>${user.email}</p>

How can access the same value through javascript.

Thanks.

 

  • Suchith

    It would be used as it is in JS also. 

    var loginname = "${user.login}"; 
  • Suchith

    It would be used as it is in JS also. 

    var loginname = "${user.login}"; 
    • Suchith's avatar
      Suchith
      Ace

      Thanks Vikas,

      Sorry, I am asking out of subject question. How can I access logged in user roles.


       

      • VikasB's avatar
        VikasB
        Boss

        Suchith

        You need to hit the endpoint if you want to get these roles in JS. 
        Here is the API

        select rank.simple_criteria from users where id='777'