Q:

How to write a simple JQuery integer division function

My webpage displays realtime data that is updated every 10 seconds from our PI server(historian server). I was recently tasked to take two peices of data that are allready displayed on my page and  divide them, displaying the new result on a graph. I have very little experience with AJAX/JQuery, so I was wondering if someone out there can lend me a hand? 
Clarification:
Hypethetically-
Say I have "Number of Grades" and "Sum of Grades" displayed on my page as basic integers. They are updated every 10 seconds from the server. I want to take those two pieces of live data, divide them, and display the result (in this case it would be the overall average  grade). So, my page will display Number of Grades, Sum of Grades, and Average Grade all updated in real time, every 10 seconds.
I am unclear as to whether JQuery can simply take those values off the server and perform division on them and return a value, or if other steps need to be taken to achieve this. I'm completely shooting in the dark here so sorry in advance for any vagueness or lack of required information.Thank you.  Some example code is given below:
<span class = 'PIdata' data-tag = 'NumOfGrades' data-on_pi_change = 'NumOfGradeChange'></span>

<span class = 'PIdata' data-tag = 'SumOfGrades' data-on_pi_change = 'SumOfGradeChange'></span>

I want to display a value that divides NumOfGrades by SumOfGrades.

A:

var sumOfGrades = parseFloat($.('#SumOfGradesId').text());
var numberOfGrades = parseFloat($.('#NumberOfGradesId').text());

var result = fn(sumOfGrades , numberOfGrades);

$.('#AverageGradeId').text(result);

This will set the required value.

