I'm using this function
function returnDatas(param) {
return param;
}
function getCartProducts(id, callback){
$.post(path, {id: parseInt(id)}, function(data){
callback(data); // data value can be 'true' or 'false'
});
}
var isData = getCartProducts(1, returnDatas);
if( isData ){
// true
}
it doesn't work for me basically I want to pass the data from the $.post to a variable outside the post.