Support the ongoing development of Laravel.io →
Authentication Requests Session
Last updated 2 years ago.
0

check the ajax response you get the http code must be 302. which is a redirect. you need to check the http code and redirect yourself using js.

0

Ajax call is not working in my code, find the below code.

<!DOCTYPE html> <html lang="en"> <header> <meta name="_token" content="{!! csrf_token() !!}"/> </header> <body> <div class="secure">Secure Login form11</div> <form action="login" method="POST" id="myform"> <div class="control-group"> <div class="controls">
 <input type="text" name="email" id="" class="form-control span6" placeholder="Email">
</div> </div> <div class="control-group"> <div class="controls"> <input type="password" class="form-control span6" name="password" placeholder="Please Enter your Password"> </div> </div>

<button type="button" class="send-btn" name="login">login</button>

</form> </body> <script type="text/javascript" src="assets/js/jquery.min.js"></script> <script type="text/javascript" src="assets/js/jquery.ui.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $.ajaxSetup({ headers: { 'X-CSRF-Token' : $('meta[name=_token]').attr('content') } }); $('.send-btn').click(function(){ $.ajax({ url: 'login', type: "post", data: {'email':$('input[name=email]').val(), '_token': $('input[name=_token]').val()}, success: function(data){ alert(data); } }); }); }); </script> </html>

Throwing: jquery.min.js:6 POST http://localhost/mylaravel/public/login 500 (Internal Server Error)

0

Ajax call is not working in my code, find the below code.

<!DOCTYPE html> <html lang="en"> <header> <meta name="_token" content="{!! csrf_token() !!}"/> </header> <body> <div class="secure">Secure Login form11</div> <form action="login" method="POST" id="myform"> <div class="control-group"> <div class="controls">
 <input type="text" name="email" id="" class="form-control span6" placeholder="Email">
</div> </div> <div class="control-group"> <div class="controls"> <input type="password" class="form-control span6" name="password" placeholder="Please Enter your Password"> </div> </div>

<button type="button" class="send-btn" name="login">login</button>

</form> </body> <script type="text/javascript" src="assets/js/jquery.min.js"></script> <script type="text/javascript" src="assets/js/jquery.ui.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $.ajaxSetup({ headers: { 'X-CSRF-Token' : $('meta[name=_token]').attr('content') } }); $('.send-btn').click(function(){ $.ajax({ url: 'login', type: "post", data: {'email':$('input[name=email]').val(), '_token': $('input[name=_token]').val()}, success: function(data){ alert(data); } }); }); }); </script> </html>

Throwing: jquery.min.js:6 POST http://localhost/mylaravel/public/login 500 (Internal Server Error)

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Payetus payetus Joined 24 May 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.