How can I get data in database in every selecting data in drop-down list using JQuery or VueJS in laravel 5.1
- I display the data in drop-down`
<div class="form-group">
<label>Customer Name:</label>
<select class="form-control" name="customer_name" id="customer_name">
<option value="">-- Customer Name --</option>
@foreach(App\Customer::where('active', 1)
->where('process_id', 1)
->get()
as $cn)
<option value=""></option>
@endforeach
</select>
</div>
- I create onchange they get the value of drop-down (which is the id of customer name)
<script>
$("#customer_name").change(function ()
{
var customer = document.getElementById("customer_name").value;
document.getElementById("ct").value = customer
});
</script>
- Displaying data depend of want selected data(sample only)
<input type="text" style="border: 1px solid #505050;" readonly=true id="ct" value="">
Database like this
Customer Table
`Id customer_name series customer_code`
1 Avon 01 AV
2 Alaska 23 AL
3 DelMonte 25 DM
The output is something like this customer_code - series - date now
- AV-01-062117
- AL-23-062117
-
DM-25-062117
If I have a wrong format please correct me. Thank you
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire