Very good I have a problem to redirect from use ajax post request
the problems is the following:
I have a div which receives only all the validation texts that could occur in the request
<div id="resultado">
</div>
and i have my ajax request
$(function(){
$("#btn_entrar").click(function(){
var url = "clases/loginclass.php";
$.ajax({
type:"POST",
url: url,
data: $("#frm_login").serialize(),
success: function(data){
if(data.redirect){
window.location.href = data.redirect;
}else {
$("#resultado").html(data);
}
}
});
return false;
});
});
when wanting to redirect from the loginclass.php document with the code
header('Location: ../reporte.php');
Nothing happens what am I doing wrong?
Do it with
window.location
orlocación.href
, I assume youdata.redirect
have oneURL
:The return false is not necessary.