Hi I have an ajax that gives result of my Balance when a particular is selected. My question is I want it to show with 2 decimal places even the amount is not in decimal form.
For example:
9000 = 9000.00
9000.1 = 9000.10
9000.11 = 9000.11
9000.159 = 9000.16
The form looks like this to give you a view of the result.
I have already tried the toFixed that is mostly answered but I cannot seem to make it work here, I have tried 2 codes.
1st code:
function specificBalance(row = null)
{
$('#subpaymentamount'+row).val('');
calculateTotalAmount();
var particulars = $('#subparticulars'+row).val();
$.ajax({
url: baseUrl+'/admin/summary/fetchSpecificBalance/'+schoolyearId+'/'+studentId+'/'+particulars,
type: 'post',
dataType: 'json',
success:function(response) {
$('#subpaymentbalance'+row).val(response.feestudent_amount).toFixed(2);
} // /successs
}); // /ajax
}
2nd Code:
function specificBalance(row = null)
{
$('#subpaymentamount'+row).val('');
calculateTotalAmount();
var particulars = $('#subparticulars'+row).val();
$.ajax({
url: baseUrl+'/admin/summary/fetchSpecificBalance/'+schoolyearId+'/'+studentId+'/'+particulars,
type: 'post',
dataType: 'json',
success:function(response) {
parseFloat($('#subpaymentbalance'+row).val(response.feestudent_amount)).toFixed(2);
} // /successs
}); // /ajax
}
Still same results.