在调用ajax请求成功响应后,Window.location不起作用,它调用了成功函数。
当我在调试器上逐步执行firefox时,window.location可以正常工作。
function login(){
var jason ={"usuario":document.getElementById("inputusuario").value,
"password": document.getElementById("inputpassword").value
};
json =JSON.stringify(jason);
console.log(json);
var onSuccess = function (data) {
console.log('Success');
window.location ='salas.html'
};
var onError = function (jqXHR, textStatus, errorThrown) {
console.log(jqXHR);
console.log(textStatus);
console.log(errorThrown);
alert("no se conecto");
};
var onBeforeSend = function () {
console.log("Loading");
};
var jason ={"usuario":document.getElementById("inputusuario").value,
"password": document.getElementById("inputpassword").value
};
json =JSON.stringify(jason);
$.ajax({
url: "../reservaciones/index.php/login",
type:"POST",
data: json,
cache: false,
async: false,
beforeSend: onBeforeSend,
error: onError,
success: onSuccess
});
};