I have a php file which passes a JSON to javascript.
$testjson = array(
"result" => true,
"count" => 1
);
$json = json_encode($testjson);
echo $json;
JS:
$.get("serverside.php", function(data, status) {
console.log((data));
});
The problem is that instead of getting the object, console prints:
<br />
<font size='1'><table class='xdebug-error xe-notice' dir='ltr' border='1' ...
I realized it means I have an error in php file. but how should I log in console the runtime php error?
You should fix the underlying PHP errors. It looks like you have xdebug
installed so all it's letting you know is you have a problem with your code somewhere.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.