location.href不跳转是怎么回事
function login(type, referer)
{
var username = $("#username_login").val();
var password = $("#password_login").val();
var keep = $("#keep_login").attr("checked") == 'checked' ? 1 : 0;
if (username == '')
{
$("#username_login").focus();
return false;
}
if (password == '')
{
$("#password_login").focus();
return false;
}
$("#submit_login").val('登录中...').attr('disabled', true);
$.post(SITE_URL+'member/login/dologin?rand=' + Math.random(), {"username":username,"password":md5(password),"keep":keep}, function(response)
{
if (response.error_code)
{
if (type == 1)
{
show_alert(response.msg+'('+response.error_code+')');
}
else
{
$('#show_info').html(response.msg+'('+response.error_code+')');
}
$("#submit_login").val('登 录').attr('disabled', false);
}
else
{
if (type == 1)
{
if (referer)
{
location.href = referer;
}
else
{ location.href = SITE_URL+"member/follow";
if (response.data.is_complete_profile)
{
if (response.data.is_upload_avatar)
{
//alert(SITE_URL+"member/follow");return false;
location.href = SITE_URL+"member/follow"; }
else
{
location.href = SITE_URL+"member/profile/avatar";
}
}
}
}
else
{
if (referer)
{
location.href = referer;
}
else
{
location.reload();
}
}
}
}, "json");
}
这是一个登陆函数,执行到红色字体那,alert有结果,也是正确的,但是location.href却不跳转是怎么回事???
跳转地址是正确的。
------解决方案--------------------
前面没有http://,还有你确定单引号是英文的单引号''
------解决方案--------------------
可能是浏览器缓存
url 后面加 随机数 来解决
http.baidu.com?t=1111111111