I am getting the 500 Error for some Ajax calls (post and get). I am only getting these in my production(ubuntu server) not local (xampp). CSRF token is sent for the request. Does anybody know what I could do?
the request that works:
$.ajax({
type: 'get',
url:getHerstellerUri,
success:function(data){
$.each(data,function(j,value){
var option =$("<option>",
{text : value.hersteller})
$('#hersteller1').append(option);
})
})
and here the one that does not work:
$.ajax({
type: 'post',
url:readHerstellerUri,
dataType: "json",
data:{'title':herstellerAuswahl},
success:function(data){
....
my web.php for these ajax calls is:
Route::get('/getHersteller', 'HerstellerController@getHersteller')->name('getHersteller');
Route::post('/readHersteller', 'BikeController@readHersteller')->name('readHersteller');
and the .htaccess which differs from the local one:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle http -> https redirect
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ /index.php [L]
</IfModule>
It was a problem of my controller(laravel). Some routes did not work with all controllers. I have no idea why, but if a put the function of the request to another controller it works.
500 status code is server error. so correct your server-side script