不应该啊,应该是可以看到的,变成NaN的原因是JS计算错误,JS代码可以修改如下,可以参考下:
$(".minus").click(function(){
var cartid = $("input[name=productnum]").attr('id');
var num = parseInt($("input[name=productnum]").val()) - 1;
if (parseInt($("input[name=productnum]").val()) <= 1) {
var num = 1;
}
var total = parseFloat($(".value.pull-right span").html());
var price = parseFloat($(".price span").html());
changeNum(cartid, num);
var p = total - price;
if (p < 0) {
var p = "0";
}
$(".value.pull-right span").html(p + "");
$(".value.pull-right.ordertotal span").html(p + "");
});
$(".plus").click(function(){
var cartid = $("input[name=productnum]").attr('id');
var num = parseInt($("input[name=productnum]").val()) + 1;
var total = parseFloat($(".value.pull-right span").html());
var price = parseFloat($(".price span").html());
changeNum(cartid, num);
var p = total + price;
$(".value.pull-right span").html(p + "");
$(".value.pull-right.ordertotal span").html(p + "");
});
function changeNum(cartid, num)
{
$.get('$url', {'productnum':num, 'cartid':cartid}, function(data){
location.reload();
});
}