Hello,

I've got the following code:

  function validateServer(value) {
    var valid;
    $.get("validate.php", { "value" : value }, function(data) {
      valid = (parseInt(data) === 1) ? true : false;
    }
    return valid;
  }

As you may have noticed, it doesn't work because the "return valid" get executed before the callback is.

My question is: Is there a way to 1) call a function, 2) have this function call a page with an AJAX request and 3) make the function return the value returned by the AJAX request.

Thank you!

--
Name : Rémi Prévost
Job  : Développeur web
Work : http://exomel.com
Blog : http://remiprevost.com
Mobi : +14189343019

Reply via email to