My dilemma involves sending numerical values to a server using an AJAX call. For instance, numbers like 0.77
, 100
, and similar variations are being transmitted. However, upon reaching the server, the data is being interpreted differently - 0.77
as a double
, while 100
is recognized as an int
due to its lack of decimals. In order to extract the number, I utilize the following code snippet:
var nbr = parseFloat(stringVariable, 10);
Even when attempting to input 100.0
, the decimals are ultimately stripped away by the parseFloat
function.
Is there a solution available to preserve the decimal places so that the server can accurately differentiate between the data types?