1) Create a service to return the roles, run your code in the callback of it
This would work, but where do I supply my current user information?
2) You could create a widget for your masterpage, mvc layout, or just the page that this code needs to run, would render out the roles wherever you want and then your script has access to that.
Is this using the Sitefinity web designer or Visual Studio? I'm not able to get Sitefinity Thunder working in my environment.