$(function () { $("#txtPassword").keyup(function (event) { if (event.which == 13) { fnLogin(); } }); }); function fnLogin() { var _userName = jsencrypt(decrypt("8cdd29a091e29cc101042f65", "^id548f@^fueam##54325jfs"), $("#txtUserName").val()); var _password = jsencrypt(decrypt("8cdd29a091e29cc101042f65", "^id548f@^fueam##54325jfs"), $("#txtPassword").val()); alert(_userName); $.ajax({ type: "post", dataType: "json", data: { userName: _userName, password: _password }, url: "/Login/LoginInfo/", cache: false, success: function (msg) { //alert(msg); $.each(msg, function (i, item) { alert(item.CODENAME); }); } }); }