I'm writing a feature to trigger the jQuery when the dropdown box change. I need to use the PHP Laravel function to access the DB and do the math.
$('.postage_trigger').change(function(){
name = $(this)[0].name;
the_id = name.split("_");
weight = $('#weight_'+the_id[1])[0].value;
{!!""; $province = new App\Province; !!}
{!!""; $weight = "<script>document.write(weight)</script>"; !!}
{!!""; $province_id = "<script>document.write(the_id)</script>"; !!}
total = {!! $province->shippingCalculator($total_product_weight=$weight,$province_id=$province_id) !!};
console.log(total);
$('.shipping_amount').val($(this).attr('id'));
});
Referring to the answer from one of the stackoverflow post and trying to pass the data into PHP. and this is what i got from view source:
jQuery(document).ready(function(){
$(".shipping_amount").val(0.00);
var sum = 0.000;
// $('.postage_trigger :selected').each(function() {
// sum += parseFloat($(this).val());
// });
// $("#shipping_amount").val(sum);
$('.postage_trigger').change(function(){
name = $(this)[0].name;
the_id = name.split("_");
weight = $('#weight_'+the_id[1])[0].value;
total = <script>document.write(weight)</script>;
console.log(total);
$('.shipping_amount').val($(this).attr('id'));
});
});
Can anyone please give me a guide to pass it correctly? Thanks
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2hRP5YA
via IFTTT
Aucun commentaire:
Enregistrer un commentaire