I have problem with disappearing 0 from my float numbers.
my sql query returns data like:
{'a': 99.99, 'c': 669.0, 'b': 99.0, 'e': 0.0, 'd': 9.0, 'g': 0.0, 'f': 0.0, 'f2': 0.0}
but when I am getting it in $.ajax response, there is no 0 after dot.
Ajax:
$.ajax({
type: 'POST',
url: '/_edit_wishbone',
data: editing_data,
success: function(response) {
$.each( response.row, function( key, value ) {
$('.editing').children('.' + key).html( value);
});
$('.editing').removeClass('editing');
}
});
Use value.toFixed(1)
All numbers in Javascript are float, if the number is full integer, when displaying by default the dot and all following 0s will be ignored. 9.0 is the same as 9, when you try to display it JavaScript assumes you mean 9.