function checkform(for1)
{
var result=checkform1(for1);
alert(result);
}
function checkform1(form)
{
var valid=false;
var val1 = document.getElementById('security_code').value;
$.get(url, function(data) {
if(data.toString()==val1.toString())
{
var elem = document.getElementById("captchaerr");
elem.style.visibility = 'hidden';
valid=true;
}
else
{
var elem = document.getElementById("captchaerr");
elem.style.visibility = 'visible';
valid=false;
}
});
return valid;
}
result alert is always false even the condtion(data.toString()==val1.toString()) is true
how the control passes in this.
thnks..
If your ‘get’ ajax call is an async one, you can use a callback to get the result: