Reputation: 13689
How can I get my values from json_encode with a callback function
data({
"error": {
"errors": [
{
"domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Invalid Credentials"
}
});
I want to get the values of my response body so that I will know if there's an error using PHP. I need to have a callback function to easily get my values via javascript.
Upvotes: 0
Views: 2282
Reputation: 1492
Assuming you meant var_dump($response) not var_dump($result) and I understand you properly, json_encode has converted your function to a string as you cannot convert a function to json and vice versa only arrays, objects and primitives such as strings.
This maybe a help... PHP json_encode and javascript functions
Upvotes: 2