jeudi 15 août 2019

The POST method is not supported for this route. Supported methods: GET, HEAD.for /register

I am trying to POST form data using ajax:

var data = $('#form1').serialize();

        $.ajax({
            type: "post",
            url: '/register',
            data: data,
            dataType: "json",
            success: function (data) {
                console.log(typeof(data));
}});

but I get :

The POST method is not supported for this route. Supported methods: GET, HEAD

but, the web.php have the:

Auth::routes(['verify' => true]);

I tried to add the following route before the Auth::routes(['verify' => true]) :

Route::post('/register', 'RegisterController@register');

also tried clearing route cache but none of them worked.

Note: I use the similar ajax to post login data with no problem it is only with /register

what is the problem? how to fix it? please help



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire