This is my functions.php script containing the following code. The array is encoded into JSON.
functions.php
$final['custom']['main'] = queryCustom($conn, $id);
echo json_encode($final);
My global.js has the following code which makes an AJAX request in jQuery:
$.ajax({
type: "POST",
url: "functions.php", // file to reach Ajax call
dataType: "json",
data: {
action: 'custom',
id: id,
},
success:
function(data) {
setCustom(data.custom);
I want to know what the data contains in function(data)? The setCustom(data.custom), what does this mean here? Can someone provide me an explanation of this please?