I know there is a topic that covers this (How do I return the response from an asynchronous call?) but I do not understand it...
What i'm trying todo is get a specific value for each variable i specify from my getInfo function:
var colour = getInfo(schedule.schedule_id, 'colour');
var date = getInfo(schedule.schedule_id, 'date');
function getInfo(scheduleid, action) {
$.ajax({
url: 'ajax.php?schedule_id='+scheduleid,
type: 'GET',
dataType: 'JSON',
cache: false,
success: function(data){
successCallback(data, action);
},
async: false
});
}
function successCallback(data, action){
return data.action;
}
i get undefined....
EDIT How can i return an array from the ajax data so I can use it like var[1], or var[2]..etc ??