我使用jquery 1.6.2
这是我的Ajax调用函数:重定向到另一个页面不工作在jQuery中?
function remoteCall(sUrl, sQueryStr)
{
$.ajax({
type: "POST",
url: sUrl,
data: sQueryStr,
async: false,
success: function(response){
var obj = $.parseJSON(response);
if(obj.status === "N"){
alert('You have already submitted the Form');
window.location= 'www.example.com';
}
if(obj.status === "S" || obj.status === "Y"){
alert('Thank you for sumbitting the Form');
window.location= 'www.abc.com';
}
}
这window.location
不工作?
此外,当在下面的代码window.location
是工作在IE和FF,但无法在Chrome:
function remoteCall1(sUrl, sQueryStr,div)
{
$.post(sUrl, sQueryStr ,
function(response){
if(div !=''){
$('#'+div).html(unescape(response));
return true;
}else{
window.location= "www.google.com";
}
});
}
});
// return URL_Redirect;
}
请帮助。 感谢
“不工作”不是一个好的错误描述。这需要先调试。成功回调是否会触发'obj.status'包含什么? –
您是否尝试过调试并在Chrome的java控制台中通过回调方法来查看window.location是否被命中?至于我所关心的window.location是完全没问题的,在Chrome以及所有浏览器 – jcvandan