Hello All -
While I've been coding php for years, I'm a real noob at javascript/jquery and have been beating my head over this single function for almost 2 days.
I've cobbled together the valAgainstDataBase() function (shown below) from an example found online. All I need is a return value of TRUE OR FALSE which is echoed from ajax_works_v2.php.
However, all that I get is from my calling function is "undefined"
Here's the calling function:
function checkLoginForm()
{
var logn = valAgainstDataBase();
alert('return value: ' + logn);
}
Here's the function BEING CALLED that should return TRUE or FALSE:
function valAgainstDataBase()
{
$.post("ajax_works_v2.php", {username: $('[id=username]').val(),
password: $('[id=password]').val()},
function(data) {
return data;
})
}
The .php file is echoing correctly so I know the issue lies somewhere in valAgainstDataBase().
Can someone please show me the error of my ways?
Great appreciation to everyone in advance.