jeudi 21 janvier 2016

Use Ruby on Rails in Javascript script

I try to create my own SonarQube Widget and I have the following question ? I want to save in a javascript variable the result of my Metrics. The problem is that I don't succeed to use Ruby on Rails with Javascript.

 <script type="text/javascript">        
     var text =  "<%= format_measure('sonar.metric.arcadsoftware.rpg.ruleset1') %>";
     alert(text);
</script>

If I use just <p><%= format_measure('sonar.metric.arcadsoftware.rpg.ruleset1') -%> </p> the result is "True" on my widget. So I want to store the String 'True' in my javascript variable text.

Thank you

Aucun commentaire:

Enregistrer un commentaire