I'm trying to login my users with ajax with a new Laravel 5.3 project.
I've generated the auth routes, which got added to my web.php:
Auth::routes();
I have a html form with email, and password inputs and the csrf field. Then I also have this javascript file:
$("form.login").submit(function(e) {
e.preventDefault();
$.ajax({
method: "POST",
data: $("form.login").serialize(),
url: "/login"
})
.done(function(data) {
console.log(data);
});
});
When I post it however, this shows up in my network tab:
It redirects back to the original page, without returning any data.
Why is it doing this?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire