[jQuery] Internet Explorer rounding numbers on data returned .getJSON request.
Hello All,
This is my first round with jQuery, which I think is absolutely
fantastic, btw.
At any rate, I have encountered a funky bug which seems to be IE /
Internet Explorer specific.
after completing a .getJSON request, whenever a numeric value is
returned, IE is rounding the number, not returning the full decimal.
I am not seeing this behavior in Firefox or Safari.
The code to generate the JSON return data is pretty straight forward:
$json = '{ "avg": "' . $average . '", "count": "'.$count.'" }';
as you can see, all values are wrapped in double quotes.
When I load any element or event with the value from the return data
set in jquery/javascript it is always rounded to the nearest whole
number - but only on IE ! This occurs even if I pass the return data
value off to a prepared variable such as :: var rating = new Number();
example jQuery code:
$(document).ready(function() {
$.getJSON('rate.php', {
rating: '0' /* doesn't apply a new rating, just returns the
count and avg */
}, function(data) {
rating = data.avg;
histars(rating);
$('#starMsg').text(starMsg[0]).attr('title',rating);
}
);
});
for instance, this example will always set the span id=starMsg title
element to '3' on IE, but in FF or Safari the title element will be
'3.05'
I have searched around for an answer to this, as I would think it is
an IE issue, obviously - but is it perhaps related to jQuery too? Has
anyone else had this issue, if so, how do they deal with it ?
Thanks,
Jt