nevergone 0 Newbie Poster

Hello,
I want this function to be assigned to a variable but I cant get it working.
I would like something like this to work so that I could perform another tricks on the result.Currentyl it returns 'undefined' data

var decodedmsg = decode('agaj80494agh942h8g0');
var retdata;
function decode(s){
$.ajax({type: "POST",
url: "includes/decode.inc.php",
data: "s=" + s,
success:function(newmsg){
            retdata = newmsg;
            }
});
return retdata;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.