Reputation: 10929
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...
Upvotes: 0
Views: 39
Reputation: 794
you could use the ajax jQuery api to send the request : http://api.jquery.com/jQuery.ajax/
and set the async property to false.
Upvotes: 1