スパンタグとテキストボックスから値をとり、それらを掛けますが、正しく動作しません。ブラウザを調べてから、スパンタグから値が得られます。 NaNを示す乗算値(totalprice)。毎回jqueryで乗算が機能しないNaN表示
$("#addintocart").click(function() {
debugger;
var productid = $("#product_id").text();
var cartid = $("#userid").text();
var quentity = $("#txt_quentity").val();
var price = $("#p_price").text();
var totalprice =(quentity * price);
$.ajax({
url: '/Product/AddInCart',
type: 'GET',
data: { cartid: cartid, productid: productid, quentity: quentity, totalprice: totalprice },
contentType: 'application/json; charset=utf-8',
success: function (response) {
//your success code
// also count total
alert("Success");
// Successnotify();
});
},
error: function() {
alert("some error");
}
});
})
使用するvar合計= parseFloatは(のための
parseInt
を検討するかもしれないことを19の数値(10進数)注意ですオクタル数量)* parseFloat(価格);またはparseIntあなたの要件に応じて – Poria