add profile button
Hello,
I wonder why the add profile button does not work?
index.blade.php
<button class="btn btn-primary" onclick="{{ url('profile/create') }}">Add Profile</button><br><br>
web.php
Route::get('profile/create', 'ProfileController@create')->name('profile.create');
ProfileController.php
class ProfileController extends Controller
{
//
public function create()
{
return view('admin.add_profile');
}
}
If you want to use a <button> you need to use a valid JavaScript expression on the onclick attribute:
<button class="btn btn-primary" onclick="window.location.href = '{{ url('profile/create') }}'">Add Profile</button><br><br>
But as it seems you are using bootstrap, you can style a regular link as a button:
<a class="btn btn-primary" href="{{ url('profile/create') }}">Add Profile</a><br><br>
you did not use window.location in onclick attr.
Try this
<button class="btn btn-primary" onclick="window.location='{{ url(profile/create") }}'">Add Profile</button>
Please or to participate in this conversation.