0
function check () {
    var result;
        $.post('file.php', function(data) {
                    result = data;
                    });
                    return result;

    }

I can't seem to get the result since its function(data) is asynchronous... how can I achieve that in a different way?

what I want to do is to get the echoed result from file.php via check() function call in javascript...

1 Answer 1

1

you could use the ajax jQuery api to send the request : http://api.jquery.com/jQuery.ajax/

and set the async property to false.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.