I’m passing a product price back from my front end using JSON and the jQuery AJAX call. Whenever I pass a decimal back that is just an integer (21, instead of 21.50) the JSON object doesn’t include the decimal point and it isn’t filling in my decimal property on the resulting action method. Is there a simple way to force the jscript to always explicitly include the .00 for round numbers?
Share
If you want to force it to have a decimal, just call the
toFixedfunction on the number when you’re building your data for the callback.Doing that will pad the number out to two decimal places (and round if the precision is longer than that).