I'm working on Laravel 5.6 and in my controller I am pulling some data from an api which I am storing in a variable and passing it to the view. $orders is the variable.
In my view I have this block of code.
@foreach($orders as $order)
<tbody>
<tr>
<td></td>
<td></td>
<td><input type="checkbox" data-toggle="switch" class="ct-primary" id="printing" value="0" /></td>
<td><input type="checkbox" data-toggle="switch" class="ct-primary" id="engraving1" value="0" /></td>
<td><input type="checkbox" data-toggle="switch" class="ct-primary" id="engraving2" value="0" /></td>
<td><input type="checkbox" data-toggle="switch" class="ct-primary" id="assembly" value="0" /></td>
<td><input type="checkbox" data-toggle="switch" class="ct-primary" id="completed" value="0" /></td>
<td><button class="btn btn-info btn-fill btn-sm"><a href="orders/" style="color: #FFFFFF">Details</a></button></td>
</tr>
<tr>
</tbody>
@endforeach
The above is a foreach loop that goes through each order and posts it in my view... There are 200 results... Easy enough. However below it using Jquery I need to store the details into a database and run some more actions. To test out how it interacts with Jquery I've done the following code.
$(document).on('change', '#printing', function() {
console.log();
});
The problem I'm having is that $order->order_number is only the first number that is loaded when the foreach loop starts. So in the example this console.log would be 37311. My question is how would I be able to make this jquery call:
$(document).on('change', '#printing', function() {
console.log();
});
equal to each order number in the for each?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Fic6x0
via IFTTT
Aucun commentaire:
Enregistrer un commentaire