Hi All,
I have created an application. Here I have tabular form with three columns, Col1 and col2 are numbers and col3 is diffrence between col1, col2.
I am using AJAX and JavaScript to calculate the difference dynamically.
I am able to print difference like for example:- 1, 2, 1.5, -1.5. but not 0.8, -0.8, 0.1 etc..
if col1-col2 = 1.2 - able to print
if col1-col2 = 0.2 - error, unexpected token

--AJAX code:
Declare
p_curr number;
p_prev number;
p_diff number;
Begin
p_prev := to_number(apex_application.g_x01);
p_curr := to_number(apex_application.g_x02);
SELECT to_number(p_curr - p_prev) into p_diff
from dual;
-- return calculated value
sys.htp.p(p_diff);
End;
--JavaScript : executes on page load
function f_calulate_duration(pThis) {
var row_id = pThis.id.substr(4);
var s = $('#f18_'+row_id).val().replace(/[^\d.-]/g, '');
var curr = $(pThis).val().replace(/[^\d.-]/g, '');
if(!s){
var s= 0;
var prev = s;}
else{
var prev = s;}
apex.server.process
( "CALC_DIFF", { x01: prev, x02: curr },
{ success: function( pData ) {
$('#f23_'+row_id).val(pData);}}
);
}
Please suggest the solution to this.
Oracle Apex Version: 4.2.
Thank you,
Dev