401 unauthenticated
401 unauthenticated
zaki22
Posts: 1Questions: 1Answers: 0
hi, I am a beginner in web programming, just learned it a few month ago. now i'm developing some web and using datatables. i have a problem when i open the page with datatables inside, the datatables want not load, and when i debug it using chrome it said 401 unathenticated. im using laravel framework. and for the code,
public function index(Request $request, Builder $htmlBuilder)
{
if ($request->ajax()) {
$books = Book::with('author');
return Datatables::of($books)
->addColumn('action', function($book){
return view('datatable._action', [
'model' => $book,
'form_url' => route('books.destroy', $book->id),
'edit_url' => route('books.edit', $book->id),
'confirm_message' => 'Yakin mau menghapus ' . $book->title . '?'
]);
})->make(true);
}
$html = $htmlBuilder
->addColumn(['data' => 'title', 'name'=>'title', 'title'=>'Judul'])
->addColumn(['data' => 'amount', 'name'=>'amount', 'title'=>'Jumlah'])
->addColumn(['data' => 'author.name', 'name'=>'author.name', 'title'=>'Penulis'])
->addColumn(['data' => 'action', 'name'=>'action', 'title'=>'', 'orderable'=>false, 'searchable'=>false]);
return view('books.index')->with(compact('html'));
}
code for view ._action
{!! Form::model($model, ['url' => $form_url, 'method' => 'delete', 'class' => 'form-inline js-confirm', 'data-confirm' => $confirm_message]) !!}
<a href="{{ $edit_url }}">Ubah</a> |
{!! Form::submit('Hapus', ['class'=>'btn btn-xs btn-danger']) !!}
{!! Form::close()!!}
sorry for my bad english, hope my question understandable.
This discussion has been closed.
Answers
I'm afraid that isn't a DataTables issue, but rather one to do with whatever authentication you are using for the server. Possibly a file permission error or some kind of authentication in the http server itself or laravel - I'm afraid I don't know!
Allan