Hello i need help to pass the data for my src image in modal using jQuery.
view.blade.php
@foreach ($users as $user)
<td></td>
<button class="btn-success showuser"
data-id=""
data-userphoto=""
data-toggle="modal" data-target="#modal-insert">
<i class="fa fa-pencil" align="center">Insert Proof</i>
</button>
@endforeach
$(document).ready(function(){
//Upload
$(document).on('click', '.showuser', function() {
$('#iduser').val($(this).data('id'));
$('#userphoto').val($(this).data('userphoto'));
});
});
I have id user and userphoto(filename) as data and then i pass it to my modal
<div class="modal fade" id="modal-insert">
<div class="modal-dialog" role="document">
<div class="form-group">
<input type="number" name="id" id="iduser">
</div>
<div class="form-group">
<input type="file" class="form-control" name="user_photo" id="userphoto">
<img style="max-width: calc(100% - 20px)" src="/storage/(**contain id="userphoto"**)">
</div>
How to make my src can contain the value of id="userphoto" ? Thanks for the suggestion
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire