I am currently working on a php project. I need to post two values, a username and password value to a php script to check that a user account exists.
I have it working fine posting the username only but don't know how to post multiple values to it.
Below is the code that I currently have
function checkAccount()
{
var username = $(\'#txtUsername\').val();
var password = $(\'#txtPassword\').val();
$.post("phpHandler/login.php"), {username: username},
function(result)
{
if (result == "unknownUser")
{
$(\'#msg\').html("Unknown username and password").addClass(\'formError\');
$(\'#msg\').fadeIn("slow");
}
}
}
For the line
$.post("phpHandler/login.php"), {username: username},
I tried to do
$.post("phpHandler/login.php"), {username: username, password: password}, but this doesn't seem to work.
Thanks for any help you can provide
'#txtPassword'
, and not an element with id#txtPassword
. – Marc B Oct 27 '11 at 21:57