Run below command in CMD,
php artisan view:clear
php artisan cache:clear
php artisan route:clear
Can you show your web.php?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
When I try to load my web page I get this error :
DataTables warning: table id=users_table - Ajax error. For more information about this error, please see http://datatables.net/tn/7
When I go to the network tab it's showing this error :
{message: "", exception: "Symfony\Component\HttpKernel\Exception\NotFoundHttpException",…}
exception: "Symfony\Component\HttpKernel\Exception\NotFoundHttpException"
file: "/var/www/html/Raylan-gestion-magasin/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php"
line: 179
message: ""
trace: [{,…}, {,…}, {,…}, {,…}, {,…},…]
Run below command in CMD,
php artisan view:clear
php artisan cache:clear
php artisan route:clear
Can you show your web.php?
@munazzil Thank You. My problem solved by this.
php artisan route:clear
php artisan optimize
Do you have a Route matching the URL that is being requested by Datatables?
@tykus yes, this is the route of the page that's showing the error :
Route::get('Administration/gestion_utilisateurs', 'UtilisateursController@View_administration_gestion_utilisateurs');
Route::get('Admin_gestion_utilisateurs/gestion_utilisateurs', 'UtilisateursController@gestion_utilisateurs')->name('administration.gestion_utilisateurs');
Route::get('Admin_gestion_utilisateurs/fetchuser', 'UtilisateursController@fetchuser')->name('administration.fetchuser');
Route::get('Admin_gestion_utilisateurs/postuser', 'UtilisateursController@postuser')->name('administration.postuser');
Route::get('/Administration/gestion_utilisateurs', 'UtilisateursController@getRole');
Route::get('Administration/gestion_utilisateurs/fetchPosteNom', 'UtilisateursController@fetchPosteNom')->name('administration.gestion_utilisateurs.fetchPosteNom');
Route::get('Administration/gestion_utilisateurs/fetchPosteID', 'UtilisateursController@fetchPosteID')->name('administration.gestion_utilisateurs.fetchPosteID');
Route::get('Administration/gestion_utilisateurs/removeuser', 'UtilisateursController@removeuser')->name('administration.gestion_utilisateurs.removeuser');
View :
$('#users_table').DataTable({
"processing": true,
"serverSide": true,
"ajax": "{{ route('administration.gestion_utilisateurs') }}",
"columns":[
{ "data": "id"},
{ "data": "username"},
//{ "data": "password"},
{ "data": "role" },
{ "data": "poste_nom"},
{ "data": "poste_id"},
{ "data": "modifier"},
{ "data": "supprimer"}
],
'rowCallback': function(row, data, index){
$('td', row).eq(4).html('poste ' + data['poste_id']);
}
});
Url :
http://192.168.100.222:8000/Administration/gestion_utilisateurs
Your url missing some things Admin_gestion_utilisateurs/gestion_utilisateurs in your controller function,
http://192.168.100.222:8000/Administration/Admin_gestion_utilisateurs/gestion_utilisateurs
but you are given url,
http://192.168.100.222:8000/Administration/gestion_utilisateurs
@munazzil I updated my post, I puted all the routes of the view that's showing the error.
It could be post_id or poste_id can you check it?.
in your below code,
'rowCallback': function(row, data, index){
$('td', row).eq(4).html('poste ' + data['poste_id']);
}
I already checked eveything I can't find why !?
Does it work if you call http://192.168.100.222:8000/Administration/gestion_utilisateurs manually in the browser?
@resin yes the page load but with empty datatable.
Isnt http://192.168.100.222:8000/Administration/gestion_utilisateurs your api/ajax endpoint? If now can you test that manually in the browser? It should return json
It's returning the same error in my first post
Check with below commands as well,
php artisan serve
Have you used below command and check every routes,
php artisan route:list
and before run,
npm run dev
Here is all my route :
+--------+----------+---------------------------------------------------+---------------------------------------------------+----------------------------------------------------------------------------+--------------+
| Domain | Method | URI | Name | Action | Middleware |
+--------+----------+---------------------------------------------------+---------------------------------------------------+----------------------------------------------------------------------------+--------------+
| | GET|HEAD | / | | Closure | web |
| | GET|HEAD | Admin_gestion_postes/addposte | administration.addposte | App\Http\Controllers\UtilisateursController@addposte | web |
| | GET|HEAD | Admin_gestion_postes/fetchposte | administration.fetchposte | App\Http\Controllers\UtilisateursController@fetchposte | web |
| | GET|HEAD | Admin_gestion_postes/gestion_postes | administration.gestion_postes | App\Http\Controllers\UtilisateursController@gestion_postes | web |
| | GET|HEAD | Admin_gestion_utilisateurs/fetchuser | administration.fetchuser | App\Http\Controllers\UtilisateursController@fetchuser | web |
| | GET|HEAD | Admin_gestion_utilisateurs/gestion_utilisateurs | administration.gestion_utilisateurs | App\Http\Controllers\UtilisateursController@gestion_utilisateurs | web |
| | GET|HEAD | Admin_gestion_utilisateurs/postuser | administration.postuser | App\Http\Controllers\UtilisateursController@postuser | web |
| | GET|HEAD | Admin_log_inspection/log_ns | administration.log_ns | App\Http\Controllers\UtilisateursController@log_ns | web |
| | GET|HEAD | Admin_log_inspection/log_reparation | administration.log_reparation | App\Http\Controllers\UtilisateursController@log_reparation | web |
| | GET|HEAD | Administration/Admin_gestion_postes/removeposte | administration.gestion_postes.removeposte | App\Http\Controllers\UtilisateursController@removeposte | web |
| | GET|HEAD | Administration/gestion_postes | | App\Http\Controllers\UtilisateursController@getPosteRole | web |
| | GET|HEAD | Administration/gestion_utilisateurs | | App\Http\Controllers\UtilisateursController@getRole | web |
| | GET|HEAD | Administration/gestion_utilisateurs/fetchPosteID | administration.gestion_utilisateurs.fetchPosteID | App\Http\Controllers\UtilisateursController@fetchPosteID | web |
| | GET|HEAD | Administration/gestion_utilisateurs/fetchPosteNom | administration.gestion_utilisateurs.fetchPosteNom | App\Http\Controllers\UtilisateursController@fetchPosteNom | web |
| | GET|HEAD | Administration/gestion_utilisateurs/removeuser | administration.gestion_utilisateurs.removeuser | App\Http\Controllers\UtilisateursController@removeuser | web |
| | GET|HEAD | Administration/log_ns | | App\Http\Controllers\UtilisateursController@Vadministration_log_ns | web |
| | GET|HEAD | Administration/log_reparation | | App\Http\Controllers\UtilisateursController@Vadministration_log_reparation | web |
| | GET|HEAD | Inspection | | App\Http\Controllers\UtilisateursController@Vinspection | web |
| | POST | Inspection/produit | | App\Http\Controllers\UtilisateursController@show_modele | web |
| | GET|HEAD | Inspection/produit/ns | inspection.produit.ns | App\Http\Controllers\UtilisateursController@inspection | web |
| | GET|HEAD | Magasin | | App\Http\Controllers\UtilisateursController@getArticle | web |
| | GET|HEAD | Produit | | App\Http\Controllers\UtilisateursController@Vproduit | web |
| | GET|HEAD | Reparation | | App\Http\Controllers\UtilisateursController@Vreparation | web |
| | GET|HEAD | Reparation/getPanne | Reparation.getPanne | App\Http\Controllers\UtilisateursController@getPanne | web |
| | POST | Reparation/reparer | reparation.reparer | App\Http\Controllers\UtilisateursController@reparer | web |
| | GET|HEAD | Role | | App\Http\Controllers\UtilisateursController@successlogin | web |
| | GET|HEAD | Type_produit | | App\Http\Controllers\UtilisateursController@getModele | web |
| | GET|HEAD | Type_produit/fetchModele | Type_produit.fetchModele | App\Http\Controllers\UtilisateursController@fetchModele | web |
| | GET|HEAD | api/user | | Closure | api,auth:api |
| | GET|HEAD | login | | App\Http\Controllers\UtilisateursController@index | web |
| | POST | login/checklogin | | App\Http\Controllers\UtilisateursController@checklogin | web |
| | GET|HEAD | login/logout | | App\Http\Controllers\UtilisateursController@logout | web |
| | GET|HEAD | magasin/ajtqte | magasin.ajtqte | App\Http\Controllers\UtilisateursController@ajtqte | web |
| | GET|HEAD | magasin/getMag | magasin.getMag | App\Http\Controllers\UtilisateursController@getMag | web |
| | GET|HEAD | produit/fetchdata | produit.fetchdata | App\Http\Controllers\UtilisateursController@fetchdata | web |
| | GET|HEAD | produit/getPro | produit.getPro | App\Http\Controllers\UtilisateursController@getPro | web |
| | GET|HEAD | produit/modifier | produit.modifier | App\Http\Controllers\UtilisateursController@modifier | web |
| | GET|HEAD | produit/upd | produit.upd | App\Http\Controllers\UtilisateursController@upd | web |
| | GET|HEAD | validate/magasin | validate.magasin | App\Http\Controllers\UtilisateursController@magasin | web |
| | GET|HEAD | validate/produit | validate.produit | App\Http\Controllers\UtilisateursController@produit | web |
+--------+----------+---------------------------------------------------+---------------------------------------------------+----------------------------------------------------------------------------+--------------+
And the url you are calling (the api/ajax one) is ?
@resin pls read my second post,
"ajax": "{{ route('administration.gestion_utilisateurs') }}",
So you are calling http://192.168.100.222:8000/Admin_gestion_utilisateurs/gestion_utilisateurs ?
@resin when I call http://192.168.100.222:8000/Admin_gestion_utilisateurs/gestion_utilisateurs it shows only the data from database :
{"draw":0,"recordsTotal":3,"recordsFiltered":3,"data":[{"id":"1","username":"Admin","password":"y$JkjnEoOqgViMpzhllJGLMO2XVDgkJR7gJiSrxBkU5iCW56dFnwKSG","role":"Administrateur","poste_nom":"Administration","poste_id":0,"modifier":"<a href=\"#\" class=\"btn btn-xs btn-warning Modifier\" id=\"1\"><i class=\"glyphicon \nglyphicon-edit\"><\/i> Modifier<\/a>","supprimer":"<a href=\"#\" class=\"btn btn-xs btn-danger Supprimer\" id=\"1\"><i class=\"glyphicon \nglyphicon-minus\"><\/i> Supprimer<\/a>"},{"id":"2","username":"Sami","password":"y$dW..0wXaNMJheBpwvP3WyO\/9aDsdsf\/r4M16bX3P2GJ7hhZgWSSve","role":"Administrateur","poste_nom":"Administration","poste_id":0,"modifier":"<a href=\"#\" class=\"btn btn-xs btn-warning Modifier\" id=\"2\"><i class=\"glyphicon \nglyphicon-edit\"><\/i> Modifier<\/a>","supprimer":"<a href=\"#\" class=\"btn btn-xs btn-danger Supprimer\" id=\"2\"><i class=\"glyphicon \nglyphicon-minus\"><\/i> Supprimer<\/a>"},{"id":"17","username":"Ahmed","password":"yLARACASTS_SNIPPET_PLACEHOLDERvkgVxZcLncMKe13E1gtju40alGlGohqwSz17J3qT\/c9HtGJt1Ek.","role":"Inspecteur","poste_nom":"Inspection","poste_id":"1","modifier":"<a href=\"#\" class=\"btn btn-xs btn-warning Modifier\" id=\"17\"><i class=\"glyphicon \nglyphicon-edit\"><\/i> Modifier<\/a>","supprimer":"<a href=\"#\" class=\"btn btn-xs btn-danger Supprimer\" id=\"17\"><i class=\"glyphicon \nglyphicon-minus\"><\/i> Supprimer<\/a>"}],"input":[]}
But when I call http://192.168.100.222:8000/Administration/gestion_utilisateurs it displays my webpage with the error in my first post.
Ok great. That means the url is working.. Good start.
Now try this (just as a test).
$('#users_table').DataTable({
"processing": true,
"serverSide": true,
"ajax": "http://192.168.100.222:8000/Admin_gestion_utilisateurs/gestion_utilisateurs",
"columns":[
{ "data": "id"},
{ "data": "username"},
//{ "data": "password"},
{ "data": "role" },
{ "data": "poste_nom"},
{ "data": "poste_id"},
{ "data": "modifier"},
{ "data": "supprimer"}
],
'rowCallback': function(row, data, index){
$('td', row).eq(4).html('poste ' + data['poste_id']);
}
});
@resin It give me the same result as :
"ajax": "{{ route('administration.gestion_utilisateurs') }}",
With the same error.
Try opening your console tools using f12 (in chrome), mark XHR, and reload the page. The failing url should show up in the list. Select the response and check the Request url under the Headers tab. Is the url correct?
@resin Here is the result of what's showing :
{
"message": "",
"exception": "Symfony\Component\HttpKernel\Exception\NotFoundHttpException",
"file": "/var/www/html/Raylan-gestion-magasin/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php",
"line": 179,
"trace": [
{
"file": "/var/www/html/Raylan-gestion-magasin/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 634,
"function": "match",
"class": "Illuminate\Routing\RouteCollection",
"type": "->"
},
{
"file": "/var/www/html/Raylan-gestion-magasin/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 623,
"function": "findRoute",
"class": "Illuminate\Routing\Router",
"type": "->"
},
{
"file": "/var/www/html/Raylan-gestion-magasin/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 612,
"function": "dispatchToRoute",
"class": "Illuminate\Routing\Router",
"type": "->"
},
{
"file": "/var/www/html/Raylan-gestion-magasin/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
"line": 176,
"function": "dispatch",
"class": "Illuminate\Routing\Router",
"type": "->"
},
{
"file": "/var/www/html/Raylan-gestion-magasin/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 30,
"function": "Illuminate\Foundation\Http\{closure}",
"class": "Illuminate\Foundation\Http\Kernel",
"type": "->"
},
{
"file": "/var/www/html/Raylan-gestion-magasin/vendor/fideloper/proxy/src/TrustProxies.php",
"line": 57,
"function": "Illuminate\Routing\{closure}",
"class": "Illuminate\Routing\Pipeline",
"type": "->"
},
{
"file": "/var/www/html/Raylan-gestion-magasin/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 163,
"function": "handle",
"class": "Fideloper\Proxy\TrustProxies",
"type": "->"
},
{
"file": "/var/www/html/Raylan-gestion-magasin/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/var/www/html/Raylan-gestion-magasin/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
"line": 21,
"function": "Illuminate\Routing\{closure}",
"class": "Illuminate\Routing\Pipeline",
"type": "->"
},
{
"file": "/var/www/html/Raylan-gestion-magasin/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 163,
"function": "handle",
"class": "Illuminate\Foundation\Http\Middleware\TransformsRequest",
"type": "->"
},
{
"file": "/var/www/html/Raylan-gestion-magasin/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/var/www/html/Raylan-gestion-magasin/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
"line": 21,
"function": "Illuminate\Routing\{closure}",
"class": "Illuminate\Routing\Pipeline",
"type": "->"
},
{
"file": "/var/www/html/Raylan-gestion-magasin/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 163,
"function": "handle",
"class": "Illuminate\Foundation\Http\Middleware\TransformsRequest",
"type": "->"
},
{
"file": "/var/www/html/Raylan-gestion-magasin/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/var/www/html/Raylan-gestion-magasin/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php",
"line": 27,
"function": "Illuminate\Routing\{closure}",
"class": "Illuminate\Routing\Pipeline",
"type": "->"
},
{
"file": "/var/www/html/Raylan-gestion-magasin/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 163,
"function": "handle",
"class": "Illuminate\Foundation\Http\Middleware\ValidatePostSize",
"type": "->"
},
{
"file": "/var/www/html/Raylan-gestion-magasin/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/var/www/html/Raylan-gestion-magasin/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php",
"line": 62,
"function": "Illuminate\Routing\{closure}",
"class": "Illuminate\Routing\Pipeline",
"type": "->"
},
{
"file": "/var/www/html/Raylan-gestion-magasin/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 163,
"function": "handle",
"class": "Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode",
"type": "->"
},
{
"file": "/var/www/html/Raylan-gestion-magasin/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\Pipeline\{closure}",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/var/www/html/Raylan-gestion-magasin/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 104,
"function": "Illuminate\Routing\{closure}",
"class": "Illuminate\Routing\Pipeline",
"type": "->"
},
{
"file": "/var/www/html/Raylan-gestion-magasin/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
"line": 151,
"function": "then",
"class": "Illuminate\Pipeline\Pipeline",
"type": "->"
},
{
"file": "/var/www/html/Raylan-gestion-magasin/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
"line": 116,
"function": "sendRequestThroughRouter",
"class": "Illuminate\Foundation\Http\Kernel",
"type": "->"
},
{
"file": "/var/www/html/Raylan-gestion-magasin/public/index.php",
"line": 55,
"function": "handle",
"class": "Illuminate\Foundation\Http\Kernel",
"type": "->"
},
{
"file": "/var/www/html/Raylan-gestion-magasin/server.php",
"line": 21,
"function": "require_once"
}
]
}
I am really out of Ideas I double checked everything and can't find a solution to this problem ;( I think this is due to the Ubuntu server because my application is working correctly when deploying on Windows, but it is too slow compared to Ubuntu server. What is strange when deploying in Ubuntu server is that one page of my application loads correctly with datatables, while the others continue to display this error, I assume that the datatables are working properly, I also checked uper and lower cases and it's clear, I don't know what else to do!?
first of all there are duplicate entries there, which the right one?
Route::get('Administration/gestion_utilisateurs', 'UtilisateursController@View_administration_gestion_utilisateurs');
Route::get('/Administration/gestion_utilisateurs', 'UtilisateursController@getRole');
second, could you standardize all route by putting a slash "/" at the beginning of each route, something like Route::get('/Administration/gestion_utilisateurs', 'UtilisateursController@getRole');
still the same error?
@siangboon these are two fucntions : Controller :
public function Vadministration_gestion_utilisateurs()
{
return view('Admin_gestion_utilisateurs');
}
public function getRole(Request $request)
{
$role_list = DB::table('roles')
->select('role_nom')
->groupBy('role_nom')
->get();
$data = [
'role_list' => $role_list,
];
return view('Admin_gestion_utilisateurs')->with($data);
}
View :
<div class="form-group">
<label>Assigner le rôle de l'utilisateur</label>
<select name="role_id" id="role_id" required="required"
class="form-control input-lg dynamic" data-dependent="poste_nom">
<option value="">Spécifiez le rôle</option>
@foreach($role_list as $role)
<option value="{{ $role->role_nom}}">{{ $role->role_nom }}</option>
@endforeach
</select>
</div>
Yeah I tried that and still same error.
you routes are all GET method but you are showing form view, are you sending get or post request?? should there suppose to have POST method route as well?
Below both Method are get method
Route::get('Administration/gestion_utilisateurs', 'UtilisateursController@View_administration_gestion_utilisateurs'); Route::get('/Administration/gestion_utilisateurs', 'UtilisateursController@getRole');
But getRole Method is post method so your route will be
Route::post('/Administration/gestion_utilisateurs', 'UtilisateursController@getRole');
Please or to participate in this conversation.