In a jQuery ajax statement I want to receive a payload from the server and process it in another function. I am just having trouble with the syntax of the function.
$.ajax({
url: 'mypgm.pgm',
type:'POST',
dataType: 'json',
data: 'action=add' +
'&techno=' + techno +
'&activity=' + activity,
success: ajax_callback(msg),
error:function (xhr, ajaxOptions, thrownError){
alert(xhr.status);
alert(thrownError);
}
});
}
function ajax_callback(msg) {
alert(msg);
}
Response
{"response": {
"success": "0",
"message": "The Activity has been added."
}
}
mypgm.phpis responding, per the response you have here - what exactly is the problem?