How to call Laravel route in jQuery

Updated at 24-Sep-2021, By samar

How to call Laravel route in jQuery

With this article, we’ll look at some examples of how to address the "How to call Laravel route in jQuery" problem.

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.
  • Call Laravel route in jQuery

    //resources\views\home.blade.php
    var route = '{{ route("users.create") }}';
    console.log(route);
    
    //routes\web.php
    use App\Http\Controllers\UserController;
    Route::get('/users/create', [UserController::class, 'create'])->name('users.create');
    

    Output : 

    http://localhost:8000/users/create

Back to code snippet queries related laravel