In the HTML below, I want to simply divide two numbers and return the result to the page. The javascript accomplishes this, however, the variable A (GAL2_G2rAimTonsPerHr) is updated every 10 seconds or so from our PI server (historian). How can I set the variable A to equal the changing value? Is there a way I can store it in a temporary variable to be used as a divisor in the script?
< td align="left" style="font-size: 12px" width="60px"
< span class='PIData' data-tag='GAL2_G2rAimTonsPerHr' data-on_pi_change='truncReading' >< /span>
< /td>
<SCRIPT LANGUAGE="JavaScript">
function divide(n1,n2)
{
ans = n1/n2;
document.write(" "+ans+"<BR>");
return ans;
}
var a = 'GAL2_G2rAimTonsPerHr'????;
var b = 2;
divide(a,b);
</SCRIPT>