2 つの異なる種類の値を合計するのに問題があります。次のようなjsonリクエストから取得する値が1つあります。
function bakVormShipping(targetClass){
$.getJSON('http://shop.com/cart/?format=json', function(data){
$.each(data.cart.shipping.methods, function(index, methods){
if (index == "core|10292|40695" || index == "core|10292|40693" || index == "core|10292|40718"){
$('<strong/>').html('€' + (+methods.price.price_incl).toFixed(2)).appendTo(targetClass); // this is value 1
}
});
});
}
もう 1 つの値は、次のように、html ページのどこかにある div にあります。
<div class="total">Totaal (incl.btw):
<span class="grandTotal">
{{ page.cart.total.price | money }} // this is value 2
</span>
</div>
これら2つの値を合計することさえ可能ですか? もしそうなら、誰かが私にいくつかの例や方向性を教えてもらえますか? parseFloat などでさまざまなことを試しましたが、NaNまたは未定義の何も返しません。だから、いくつかの助けは大歓迎です:)