Answer the question
In order to leave comments, you need to log in
Server returns 502 (Bad Gateway) on ajax request?
Good afternoon.
When I try to get data, I get the following error 502 (Bad Gateway). At the same time, this error is only on the server, there is no such error on the local OpenServer machine. What could be the problem? Moreover, other sites on this server return data.
Here is my code:
$.ajax({
type: "get",
url: "loadEvents",
data: {count: $count},
success: function(data){
console.log(data);
}
});
$router->get('/loadEvents', '[email protected]');
public function loadEvents(Request $request)
{
$count = $request['count'];
return $count;
}
Answer the question
In order to leave comments, you need to log in
1. try to access the script directly without ajax
2. try to remove the slash in /loadEvent
3. Print an error to the console, not the result of success
Well, first of all, not $request['count']
a $request->count
or $request->input('count')
.
Secondly, if the first point did not help, go through the laravel logs along the storage/logs/*.log path, find the last one, call the round again and see if an exception appears for an hour.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question