Trying to execute this:
function getReport(name) {
$.ajax({
type: "POST",
url: "reportAjax.php",
data: "name="+ name,
success: function(data){
var json = $.parseJSON(data);
}
});
alert(data);
}
$(document).ready(function() {
getReport('mobileDevicesBreakdown_30days');
});
I’m getting data is not defined
reportAjax.php is definitely available and always return something (even if the variables that are sent to it – currently name is incorrect or missing).
Move
alert(data);inside the success callback: