I
I
Ivan2017-02-08 14:02:01
Laravel
Ivan, 2017-02-08 14:02:01

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);
      }
    });

Routing:
$router->get('/loadEvents', '[email protected]');

Well, the controller:
public function loadEvents(Request $request)
    {
        $count = $request['count'];
        return $count;
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Timofeev, 2017-02-08
@webinar

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

A
Alex Wells, 2017-02-09
@Alex_Wells

Well, first of all, not $request['count']a $request->countor $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 question

Ask a Question

731 491 924 answers to any question