I'm trying to redirect to other view after an ajax call but it doesn't work.
The ajax call works, but when it reaches the redirection line it just doesn't work and redirect to the homepage.
This is my ajax call:
<script type="text/javascript">
function feedback(ofertaId){
$.ajax({
type : "POST",
url : 'mensaje/mensajeFeedback.do',
contentType: 'application/json; charset=utf-8',
data: JSON.stringify({'ofertaId': ofertaId}),
async: false,
cache: false,
success: function(callback){
if(localStorage.getItem("language") == "en"){
alert("Your mentor has been notified successfully");
}else{
alert("Su tutor ha sido notificado correctamente");
}
window.location.href = "alumno/practicas.do";
},
error: function (xhr) {
alert('Error ' + xhr.status);
}
});
};
</script>
I have no idea why it's redirecting to homepagwe instead "alumno/practicas.do" since I've done the same thing in other ajax calls. Any idea?
EDIT:
Actually I want to do the redirection thing because the application redirects by itself to the homepage when the ajax call finishes. The redirection works if I just move the line outside the ajax call, so the line itself is working.