ChanX ChanX - 1 year ago 1127
jQuery Question

Laravel 5.1 AJAX - Returning 405 GET Method Not Allowed even when I am sending a POST request

My Laravel POST route returns 405 GET Method not allowed when I am sending a POST request through AJAX. However the problem is that it works in

but not working in Heroku
production server
. My AJAX POST request gets sent as GET request to the route. Below i have attached a screenshot and my AJAX code.

url: url,
type: 'POST',
data: data,
contentType: 'application/json',
headers: {
'X-CSRF-TOKEN': token

My route is configured as:

Route::post('/adminpanel/projects/delete/', 'AdminPanelController@deleteData');

enter image description here

Answer Source

Update your action url from



                        //^^ Removed that slash

Remove that slash and it'll work for you.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download