I want to get data pass from a function, the data successfully return inside the success response. However I can't return the data from the function itself.
function getStatusPublished(dating, product) 
{
    var datas = "";
    var success = function(response, status, headers, config){
      datas = response;
    }
    var error = function(error, status, headers, config){
      datas = "error";
    }
    var cdnss = "htttp://application_ajax";
    $http.post(cdnss+"&pblishDateVacan="+dating+"&ProjectID="+product)
    .success(success).error(error);
    console.log(datas);
}
In the console.log, it just said undefined.
Please help. Thanks.
 
    