I have example code like this:
JQ:
$.ajax({ type: 'GET', url: 'getData.php', success: function(data) { console.log(123); console.log(data); console.log(123); } });
PHP:
<?php $text = "hello"; echo $text; ?>
And I get all code like this
Why is not show 「hello」?
I run on Mamp, isn't work?
Thanks!
you have to use this in PHP:
<?php $text = "hello"; echo json_encode($text); ?>
and you have to pass
header('Content-Type: application/json');
Maybe it will helpful