I'm using simple jQuery to compare two variables, but every time it is yielding false result. Here is the code piece:
var fromIM = $("#passwordFroma").val();
loadContent(passwordValentered);
var encrypt = document.getElementById("prtCnt").value;
alert("ajax call " + encrypt);
alert(encrypt == fromIM);
In the above code piece,
passwordFroma is a hidden text field.
passwordValentered is a text box to get user input.
prtCnt is a hidden field.
Also, loadContent(passwordValentered) function is an ajax call which sets the value for hidden field prtCnt. This is confirmed from the first alert. But, when I compare the values in second alert, I always get the result as false.
Please let me know where am I going wrong! I'm using jQuery 1.9.
encryptandfromIMlook like (i.e. their values) in your JavaScript console?alert(encrypt == fromIM)call in the success function of the ajax call.