When i am trying to get json type data in return of an ajax call,i am getting undefined as return.
function AjaxCallToGetData(){
var chartDataCheckin;
var checkin_location = $("#select_checkin_location").val();
jQuery.ajax({
'url': '<?php echo $this->modurl; ?>dashboard/checkinchart',
dataType: 'json',
data: {checkin_location: checkin_location},
'type': 'POST',
success: function(data) {
alert(data); // alerts object
return data;
}
});
}
function getcheckinchart(DataCheckin) {
alert('hi');
var chartDataCheckin = AjaxCallToGetData();
alert(chartDataCheckin); // this doesnot
}
Please help