Saturday, March 4, 2017

Display data on selected item with Laravel and Ajax

I'm trying to display the selected data from table to a modal using Ajax but seems no working. I used the restful routing in laravel. Data is successfully fetched but I'm stuck in displaying it inside the modal.

Controller:

public function show($project)
{
    $project = Project::find($project);
    return \Response::json($project);
}

Ajax:

$.ajax({
    url: url,
    data: data,
    method: 'GET',
    success: function(data) {
        console.log(data)
        $("#editProject").modal('show');
    }
})



via claudios

Advertisement