i have a grid in which all users are shown . the grid is created and shown by ajax , it has 3 buttons . add , edit , remove . i can add and delete , but since in the update.blade.php i have the user image ( which is shown by a route and controller like : <img src=""/> , the problem now is how do i pass the a variable like
$user_idthat i'm about to use in the view blade ?
, this is the code that brings up the modal ( when edit button wich is right in front of user name and id is clicked . i can get user name , family and so on and show it in the modal . but how do i pass the $id to the image route that i mentioned above ?
$('body').delegate('#student-info #edit','click',function (e) {
var id = $(this).data('id');
$.get("",{id:id},function (data) {
$('#frm-update').find('#id').val(data.id);
$('#frm-update').find('#name').val(data.name);
$('#frm-update').find('#family').val(data.family);
$('#frm-update').find('#username').val(data.username);
$('#frm-update').find('#birth_date').val(data.birth_date);
$('#frm-update').find('#phone').val(data.cell_phone);
$('#frm-update').find('#email').val(data.email);
$('#frm-update').find('#gender').val(data.gender);
$('#student-update').modal('show');
})
})
here is the laravel Controller function that is called on URL::to('student/edit')
wich i have mentioned in the above $.get
code :
public function edit(Request $request) {
if($request->ajax()) {
$contact = User::find($request->id);
return response($contact);
}
}
the responsibility of above controller function which is called during $.get
is to get the information based on the id that i have passed . ( my grid already shows each user id in the the grid table i've created . but i don't know how to pass it to the src=""
Please Someone Help Me . thank you so much .
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2oKE1zB
via IFTTT
Aucun commentaire:
Enregistrer un commentaire