Input | Get The New Value Set By A Javascript Function Into A Controller Public Function
I have created a CRUD to edit existing table rows. One of its input contain already a value='19.00' saved at the creation of the row :
You need to use attr()
, so instead of lines like:
$('#ordersdetailproductprice').val('0.00');
Use:
$('#ordersdetailproductprice').attr('value', '0.00');
And then you can easily fetch the input value to send to your Controller (via AJAX I believe) as:
let value = $('#ordersdetailproductprice').val();
I hope it helps you
Solution 2:
SOLUTION AJAX CALL IN JS SCRIPT :
...
else if (d1 == 4 && d2 == 27 && d3 == '' && pl1 == 2 && pl2 == 2) { $('#productprice').val('59.00'); }
else if (d1 == 4 && d2 == 27 && d3 == '' && pl1 == 3 && pl2 == 3) { $('#productprice').val('69.00'); }
else if (d1 == 4 && d2 == 27 && d3 == '' && pl1 == 4 && pl2 == 4) { $('#productprice').val('79.00'); }
else if (d1 == 4 && d2 == 27 && d3 == '' && pl1 == 4 && pl2 == 5) { $('#productprice').val('89.00'); }
var rowID = rowid;
var orderID = $('#orderID').val();
var productprice_new = $('#productprice').val();
console.log(productprice_new,rowID,orderID);
$.ajax({
type: 'post',
url: '/assets/ajax/ajaxupdate.php',
data: {
'rowid' : rowid,
'orderID' : orderID,
'productprice_new' : productprice_new,
},
success: function (data) {
console.log('worked!');
},
error: function (data) {
console.log('Error:', data);
}
})
Post a Comment for "Input | Get The New Value Set By A Javascript Function Into A Controller Public Function"