dimanche 4 juin 2017

POST http://ift.tt/2s6qd5W 500 (Internal Server Error) in implementing laravel code

I have this ajax code

$.ajax({
    type: 'post',
    url: '/recruitment/list-position-by-department',
  data: { 'id': department_id },
    dataType: 'JSON',
    success: function(result) {
    console.log(result);
    },
    error: function(){},
    beforeSend: function(){},
});

route

Route::name('recruitment.list.position.by.department')->post('/recruitment/list-position-by-department', 'DepartmentController@getPositonByDepartment');

and a method

public function getPositonByDepartment(Request $request)
{
  echo json_encode($request->only('id'));
}

In my laravel project

but with that code above I get this result in console.log

POST http://ift.tt/2s6qd5W 500 (Internal Server Error)

What I've done wrong?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2sDaZCb
via IFTTT

Aucun commentaire:

Enregistrer un commentaire