location.href funktioniert nicht

Ich habe location.href in meinen früheren Tagen verwendet, aber jetzt ist es nicht zur Seite umzuleiten. Hier ist mein Code

function AuthenticateUserWithPage() {
var UId = $('#amwayId').val();//username
var UPw = $('#amwayPw').val();//password
var ischecked = $('#idSave').is(':checked');// check remember me checkbox status

if (UId != '' && UPw != '') {
    $.ajax({
        type: "POST",
        contentType: "application/json; charset=utf-8",
        url: "../KPPRMobService/PNBMobWebService.asmx/IsValidUserWithPage",
        data: JSON.stringify({ username: UId, password: UPw, ischecked: ischecked }),
        async: false,
        success: function (data) {
            var obj = data.d;
            if (obj != "FALSE") {
                var targetUrl = "http://" + window.location.host + obj;
                window.location.href = targetUrl;
                //window.location.replace(targetUrl);
                return false;
            }
            else {
                $('#amwayId').val('');
                //if username or password is invalid
                alert("Please check your ID or password. The ID is not registered or the ID/ password is wrong.");
            }
        },
        error: function (result) {
            //if error occured.
            $('#amwayId').val('');
            alert("You cannot log in. Contact support center for further inquiries..");
        }
    });

}
else {
    //if username or password is null
    alert("Please enter ID/ password.");
    return false;
}

}

Ich benutze diesen Link als Referenz:Referen.Danke im Voraus

Antworten auf die Frage(1)

Ihre Antwort auf die Frage