Return value from ajax call?

Posted by Dan on Stack Overflow See other posts from Stack Overflow or by Dan
Published on 2009-10-27T16:28:41Z Indexed on 2010/05/25 7:51 UTC
Read the original article Hit count: 319

Filed under:
|
|
|

Hi, I'm making a basic ajax function in jquery which echoes the number of rows found in a MySQL Query.

function checkEventIDClass(id) {
                var params = 'method=checkEventIDClash&table=test&id=' + id;
                $.ajax({
                type: "POST",
                url: "ajax.php",
                data: params,
                    success: function(result){       
                    return result;
                    }
                }); 
       }

Is it possible to use this returned value in another function? I have tried but only get undefined values. In this situation, it will be acceptable to use synchronous calls.

Any advice appreciated.

Thanks

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX