There is a table rendering some list of persons with columns like this:
<table>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Age</th>
</tr>
<tr class="person">
<td class="fname">John</td>
<td class="lname">Doe</td>
<td class="age">30</td>
</tr>
</table>
and more other. When a user clicks on a row, a new view with more data about the selected preson should get loaded, using jquery. Something like:
//main.js:
$(document).ready(function(){
$("#person").click(function(){
var lname = $(this).children("lname").val();
$.ajax({
url:'profile',
type: 'GET',
data: 'lname' : lname,
dataType: 'json',
success: function(result){
}
});
}
});
//routes.php:
Route::get('profile', [
'as' => 'profile',
'uses' => 'PagesController@profile'
]);
//controller.php
public function profile()
{
return view('pages.profile');
}
What is the correct way to do that?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire