2022-12-17

Website Redirect Code Error, how do I fix it?

Can anyone see why this script would fail to redirect?

 $.ajax({
            url: url,
            data: JSON.stringify(viewModel),
            dataType: 'json',
            contentType: 'application/json; charset=utf-8',
            cache: false,
            type: "POST",
            success: function (result) {
                if (result.success === true) {
                    showFullScreenLoadMask(false);
                    //var redirect = "/Login/Index";
                    //window.location.href = getUrlPath() + redirect;
                    var redirecturl = getUrlPath() + "/Login/Index";
                     /*F5_*/  F5_Deflate_location( /*_5F##*/ window /*F5_*/ ) /*_5F#.location#*/ .assign = redirecturl;
                  
                } else {

                    // hide any previous errors
                    $("#divPasswordHistoryError").hide();
                    $("#divFullNameError").hide();
                    $("#divCurrentPasswordError").hide();

                    if (result.vm.ShowPreviousPasswordFail === true) {
                        $("#divPasswordHistoryError").show();
                        $("#divPasswordHistoryError").removeClass("hidden");
                    }

                    if (result.vm.ShowFullNameError === true) {
                        $("#divFullNameError").show();
                        $("#divFullNameError").removeClass("hidden");
                    }

                    if (result.vm.ShowCurrentPasswordFail === true) {
                        $("#divCurrentPasswordError").show();
                        $("#divCurrentPasswordError").removeClass("hidden");
                    }
                   
                    $("#Username").val(result.vm.Username);
                    $("#Password").val(result.vm.Password);
                    $("#NewPassword").val("");
                }
            },
            error: function (responseText, textStatus, errorThrown) {
                alert('Error - ' + errorThrown);
            }
        });

Above is the code I have on my login script, but for the life of me, I cant get my head around as to why it would not be redirecting to the correct page after someone enters their password.



No comments:

Post a Comment