jQueryを使用して価格を計算しています。どのようにしてJavaScriptからPHPに変数を渡すことができますか?
// 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);
})
});
これは、マットまたは光沢仕上げが選択されているかどうかを確認した後、それがprices
div
タグ内span
への価格を挿入します。ここに私のJavaScriptの小さな断片です。
私は、その価格値を変数に割り当てる方法を知っていなければなりません。これをショッピングカートのPHPに渡すことができます。
しかし、oculdの人々は値を変更します。これは、商品のコストを効果的に変更することを意味します。 – user88039
EDITEDはより明確になります。 –