Link to home
Start Free TrialLog in
Avatar of ITsolutionWizard
ITsolutionWizardFlag for United States of America

asked on

mvc inside of javascript

I tried to get mvc class inside of javascript like below. but it alerts that fixed up with javascript codes. Is it a way to use mvc inside of javascript?

@MasterHelper.Generic.DecryptPassword(data[index].passcode);


 function UserInfo()
    {
        var userid = localStorage.getItem("userid");
        $(document).ready(function () {
            $.ajax({
                url: "/Api/UserInfo",
                datatype: "text",
                type: "POST",
                data: { 'userid': userid},
                dataType: 'json',
                success: function (data) {
                    $.each(data, function (index) {
                        var test = data[index].passcode; 
                        document.getElementById("firstname").value = data[index].firstname; 
                        document.getElementById("lastname").value = data[index].lastname; 
                        document.getElementById("passcode").value = @MasterHelper.Generic.DecryptPassword(data[index].passcode); 
                        document.getElementById("emailadr").value=data[index].email;                            
                    });
                },
                error: function (msg) { alert(msg); }
            });
        }); 
    }

Open in new window

Avatar of ITsolutionWizard
ITsolutionWizard
Flag of United States of America image

ASKER

any helps?
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial