I have a simple ajax call:
function init() {
$.ajax({
url: "./myFolder/user.php",
data: {
action: "init"
},
type: "post",
success: function (output) {
console.log("Success");
console.log("Output: " + output);
}
});
}
The PHP init
method gets called and simply should return some json data:
function init() {
$arr = array(
array(
"region" => "valore",
"price" => "valore2"
),
array(
"region" => "valore",
"price" => "valore2"
),
array(
"region" => "valore",
"price" => "valore2"
)
);
return json_encode($arr);
}
but my console says:
Success
Output:
So the output variable is empty. Where is my json data?