I am using the following code so that after login and password it is directed to the respective page. Locally it works, but when I upload to the server, it is giving Chrome error:
ERR_TOO_MANY_REDIRECTS
And in Firefox:
This problem can be caused by disabling or refusing to accept cookies.
As I said earlier, locally it works perfectly. The code I am using for redirection is:
<script type="text/javascript">
$(document).ready(function(){
$('#login-form').submit(function() {
data = $('#login-form').serialize();
$.post("validar.php",{
d: data,
},
function (d) {
console.log(d);
if(d == 1){
$('#myModal').modal('show');
}else{
var redirecionar = "sistema/";
$(window.document.location).attr('href',redirecionar);
}
});
return false;
});
});
</script>
Remember that the system / directory exists.