I’m retrieving a json string as below with jquery ajax and displaying it on a xhtml page
{"pID":"T1","avBal":147765035.20,"accBalance":147713417.00}
I have the jquery written like this,
$.ajax({
type : "GET",
url : '../accData.xhtml',
dataType : "json",
async : true,
cache : false,
success: function(data) {
if(data!=null){
$("#accBalance").text(data.accBalance);
$("#avBal").text(data.avBal);
}
},
error : function() {
}
});
The issue here is it displays the “avBal” as 147765035.2 and “accBalance” as 147713417 without the zero’s all the zero’s at the end of the values are truncated automatically. Is it a limitation in jQuery or json or something else is wrong here?
please replace your script as below: