I'm building a Laravel app with jQuery. I've a form with a select box(list of products) and text input fields.
My requirement is when I choose a product from the Select box at the top, the value of all other fields should update according to the products value that is fetched from database for the selected product.
This is my js script:
$(document).ready(function() {
var divKey = $( "#proposed_product option:selected" ).val();
$( "#proposed_product" ).change(function() {
updateKeyValues();
});
function updateKeyValues() {
$("#proposed_product").val(divKey);
console.log(proposed_product); //what to do here..???
}
});
My laravel function to return gigs list:
public function proposegigs($id){
$gig = Gig::findOrFail($id);
return $gig;
Can somebody help how to achieve this?