ajax - jQuery math two float numbers -
i try math 2 float number , add them ajax query. didnt work. here code:
// padejpremium_x 225.00 var amount = $("#padejpremium_2").val() / 100) * 2; // (225.00 / 100) * 2 = 4.5 var data = { dueamount0: $("#padejpremium_1").val() + 10.00, dueamount1: $("#padejpremium_2").val() + amount, dueamount2: $("#padejpremium_3").val() + amount, dueamount3: $("#padejpremium_4").val() + amount,
i glad if give idea. in advance.
you have missing (
in first line. check below code:
var amount = ($("#padejpremium_2").val() / 100) * 2; // (225.00 / 100) * 2 = 4.5 var data = { dueamount0: $("#padejpremium_1").val() + 10.00, dueamount1: $("#padejpremium_2").val() + amount, dueamount2: $("#padejpremium_3").val() + amount } console.log(data);
check demo here:
jsfiddle (check in console)
Comments
Post a Comment