[jQuery] Comparing two textboxes
Hi,
I wrote a script to verify if two text boxes have the same value/text.
checkpasse.php just verifies if the text box edtMdp($_POST['edtMdp'])
equals edtCMdp ($_POST['edtCMdp']), if they do: echo "yes", if the
don't echo "no"
so if the result of checkpasse.php is, for example,
"no" (datamdp=='no') then a message box will appear with a error
message
the problem: it only shows the "Vérification..." message box, line 6.
It looks like it doesn't check the result of checkpasse.php...
Please could you help me out here? thx
Here is the code:
$(document).ready(function()
{
$("#edtCMdp").blur(function()
{
//remove all the class add the messagebox classes and start fading
$
("#msgboxmdp").removeClass().addClass('messagebox').text('Vérification...').fadeIn("slow");
//check the username exists or not from ajax
$.post("checkpasse.php",{ edtMdp: $("#edtMdp").val(), edtCMdp: $
("#edtCMdp").val()} ,function(datamdp)
{
if(datamdp=='no')
{
$("#msgboxmdp").fadeTo(200,0.1,function() //start fading the
messagebox
{
//add message and change the class of the box and start fading
$(this).html('Vérifiez votre mot de
passe!').addClass('messageboxerror').fadeTo(900,1);
});
}
else
{
$("#msgboxmpd").fadeTo(200,0.1,function() //start fading the
messagebox
{
//add message and change the class of the box and start fading
$(this).html('Le mot de passe est
correcte!').addClass('messageboxok').fadeTo(900,1);
});
}
});
});
});