Skip to content
Advertisement

Ajax GET request fails in laravel 8

when i try to send a GET request with tutorial ,but its not working and end up with 500 internal server error I cant find any error by searching on forum or stackoverflow,and also i ma beginner, kindly seek your help

here is my view ajax.blade.php

JavaScript

here is the controller class

JavaScript

here is web.php Route::get('getmsg',[aController::class,'index']);

Advertisement

Answer

Update your route with

JavaScript

Laravel 8 requires you to provide a complete path to the controller or you can define a default namespace to locate your controllers like this, define following in your RouteServiceProvider.php

JavaScript

You should get a response from the controller.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement