I want to return some data after post request and keep in a local variable to use multiple times. I have written below code which returns undefined everytime.
function getSomeList()
{
    var myVariable;
    $.post("/Home/getList", { 'input': inputData })
  .done(function (data) {
      //alert("Data Loaded: " + data); // I can see the data here.
      myVariable = data;
  });
  return myVariable;
}
If call this function then it returns undefined.
  alert(getSomeList());
I also tried with old way by writing async: false and came to know that Use of "async" has been depreciated.
$.ajax({
    'async': false,
    'type': "POST",
    .
    .
    .
});
Please let me know if there is any other solution.
 
    