title: return data inside function from http post
body: <p>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. </p>
  
  <pre><code>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+"&amp;pblishDateVacan="+dating+"&amp;ProjectID="+product)
      .success(success).error(error);
  
      console.log(datas);
  }
  </code></pre>
  
  <p>In the <code>console.log</code>, it just said <code>undefined</code>.</p>
  
  <p>Please help. Thanks. </p>