How to call Laravel route in jQuery

You can call Laravel route in jQuery using route method in script tag in blade file. It will generate the URL using the route name.

Answers 1
  • Call Laravel route in jQuery

    var route = '{{ route("users.create") }}';
    use App\Http\Controllers\UserController;
    Route::get('/users/create', [UserController::class, 'create'])->name('users.create');

    Output : 

  • Back to code snippet queries related laravel

Related queries helps you to understand and may also used for implementation of current code snippet