相关疑难解决方法(0)

如何将变量从JavaScript传递给PHP?

我正在使用jQuery来计算价格.这是我的JavaScript的一小部分:

// Prices: radio
var curLam = "gloss";
$("input[name=lamination]").click(function(){
    var gloss = 5;
    var matt = 6;
    if ($(this).val() == 'gloss' && curLam != 'gloss'){
        $('#prices span').text(parseInt($('#prices span').text()) + gloss - matt);
        curLam = 'gloss';
        console.log('1');
    }
    if ($(this).val() == 'matt' && curLam != 'matt'){
        $('#prices span').text(parseInt($('#prices span').text()) - gloss + matt);
        curLam = 'matt';
        console.log('2');
    }
        $("#prices span").each(function(){
var $priceValue = $(this);
    } )

});
Run Code Online (Sandbox Code Playgroud)

此进行检查,以查看是否有粗糙的或光泽饰面已被选择,然后将其插入价格进入span的内prices div标签.

我需要知道如何将该价格值分配给变量,然后可以将其传递给我的购物车PHP.

javascript php ajax jquery

2
推荐指数
1
解决办法
936
查看次数

标签 统计

ajax ×1

javascript ×1

jquery ×1

php ×1