mardi 5 septembre 2017

error : Internal Server Error Laravel 5.4 ajax call

Using following ajax call to retrieve parameter in controller but it gives the error. The happened when I have added parameter id in ajax and controller.

   $.ajax({
            url:'/delprofile',
            type: 'delete',
            data: {  id: 5,
                    '_token': $('meta[name="csrf-token"]').attr('content')
                },
             success: function(){ alert("Record deleted.") },
        error: function(jqXHR, textStatus, errorThrown) {
            console.log(textStatus + ' : ' + errorThrown);
     }
    });

    Route::delete('/delprofile','ProfileController@delprofile');

     public function delprofile (Request $request){
        $id=$request->input('id');
         DB::table('education')->where('id','=',id)->delete();

          }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire