I have a function
function GetITStaffList(){
var go_path = "Server/ITComplains.php?action=GetITStaffList&vars=0";
$jqLibrary.get(go_path,
{}, function(data)
{
var parseData = JSON.parse(data);
console.log("GetPendingAndInProgressComplainsByGeneratorId : ", parseData);
return parseData;
});
}
I am calling this somewhere in the code like this
var ITStaffList = GetITStaffList();
MakeDropDownITStaff(ITStaffList);
But the problem is each time it is returning null. I know that I have to use callback and something like a promise but I don't how to fit this thing in my context. How do I write a reusable function with ajax call that returns data on demand.?