I have this $.post statement, I wanted to get the function outside the $.post data.
$(function(){
   var new_data = '';
   $.post('my_url', {}, function(data){
       new_data = data;
   });
   console.log(new_data);
});
This is what I did, but it does not give an output, the data im getting is a json_encoded data from PHP how can I get the data outside of the $.post statement?
 
     
    