The rule was created:
Route::post('/signup', 'AuthController@signup'); When you try to send a POST request from Ajax, this problem crashes:
Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException I didn’t find anything interesting, except how to put route="прим" on the form, which isn’t enough for me, since the form is sent to the ajax request, using the POST method, as expected.
UPD: version 4.2.
Controller Code:
class AuthController extends BaseController { public function signup () { return Response::json(array('data' => $_POST)); } } When fields are filled:
GET Data empty POST Data username test email password test confirm test submit In the js console:
test.app POST 405 Method Not Allowed text/html JS code in the studio: D
$(function() { $('#signup').submit(function(e){ e.preventDefault(); var username = $('#username').val(); var email = $('#email').val(); var password = $('#password').val(); var confirm = $('#confirm').val(); $.ajax({ type: 'post', url: '//test.app/signup', dataType: 'json', data: { username = username, email = email, password = password, confirm = confirm }, success: function (response) { console.log(response); } }); }); }); 
php artisan routes? - user13856