I called ajax (which return json data) from a javascript function like below
function getDataSets(groupID)
{
$.ajax({
type: 'POST',
dataType: "json",
url: 'del/deljson.php',
data:'groupID='+groupID,
success:function(msg){
//alert(msg);
return msg;
}
});
}
when i call this function as alert(getDataSets(1)); it return "undefined". However if i call alert on success of ajax it shows return data. what I am doing wrong.