How do I return something in JQuery?

Posted by TIMEX on Stack Overflow See other posts from Stack Overflow or by TIMEX
Published on 2011-01-11T00:44:26Z Indexed on 2011/01/11 0:53 UTC
Read the original article Hit count: 124

Filed under:
|
|
function vote_helper(content_id, thevote){
            var result = "";
            $.ajax({ 
                type:"POST",
                url:"/vote",
                data:{'thevote':thevote, 'content_id':content_id},
                beforeSend:function() {
                },
                success:function(html){
                       result = html;
                }
            });
            return result;
        };

I want to return the result. But it's returning blank string.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery