Store Java variable value into JavaScript/jQuery variable -


 <%                                                               httpsession   session1 = request.getsession();   string marks =  session1.getattribute("marks").tostring();   string percentage= session1.getattribute("percentage").tostring();   string marks1 =session1.getattribute("marks1").tostring();   int total = 25;       int m1 = integer.parseint(marks);   int m2 = integer.parseint(marks1);   float m3 =  ((m1+m2)*100)/25;   %> 

i want store float m3 value in javascript variable.

javascript / jquery code:

<script> $(document).ready(function() { // 6,32 5,38 2,34     $("#test-circle").circliful({         animation: 1,         animationstep: 5,         foregroundborderwidth: 12,         backgroundborderwidth: 12,         percent: 92,         textsize: 25,         textstyle: 'font-size: 10px;',         textcolor: '#666',         multipercentage: 2,         percentages: [10, 20, 30]     })  }); </script> 

i want javascript variable percent should value of java variable m3. want because want value in percent variable dynamic not static have written 92 in front of percent.

i know on same page can't store javascript variable java variable because jsp page loaded first. in case want store java variable m3 in float javascript variable percent.

i have little knowledge of jquery please help!

one way it:

     <%                                                                   httpsession   session1 = request.getsession();       string marks =  session1.getattribute("marks").tostring();       string percentage= session1.getattribute("percentage").tostring();       string marks1 =session1.getattribute("marks1").tostring();       int total = 25;       int m1 = integer.parseint(marks);       int m2 = integer.parseint(marks1);          %>      <script>       var m3 = <%= ((m1+m2)*100)/25 %>; // javascript line     </script>   

now m3 javascript variable, accessible rest of code.


Comments