Actually i am creating changepassword page. and this is my function of checking old password is match with the existing password or not. And that password is stored in MD5 in database so i want to first convert that password in MD5 and after that i can check that password.
Here is the code.
function fnIsValidOldPassword()
{
var oldPassword = ;
var objUser = new Object();
objUser.UserID = <?php echo $_SESSION['UserId'] ?>;
$.ajax({
type: POST,
url: db.php?GetUser,
data: {data:objUser},
async:false,
dataType:json,
success: function(response)
{
if(response.IsError)
alert(response.ErrorMessage);
else
oldPassword = response.Records[0].Password;
},
error:function(message)
{
alert(Error: + message);
}
});
if($.md5($(#txtOldPassword).val())) != oldPassword)
^^ //here it shows error. that md5 is not a function.
{
$(#errorPassword)[0].innerHTML = Wrong Old Password.;
$(#txtOldPassword).removeClass(successTextBox).addClass(errorTextBox);
return false;
}
$(#txtOldPassword).removeClass(errorTextBox).addClass(successTextBox);
$(#errorPassword)[0].innerHTML = ;
return true;
}
md5 is not a function in jquery then how to convert the password in md5.