I get statusText: OK value, but I cannot get PHP object or array values. https://paste.fedoraproject.org/paste/1-HWWEJKvSbCYKUkoGHytA
I have Fedora 30 with 2.4.39 HTTPd, PHP 7.6, MySQL: 10.3.12. I'm using latest jQuery. I set it into my PHP file:
header('Content-type: application/json');
$.ajax({
url: 'get.php',
type: 'post',
})
.done(function(a) {
$("#workSpace").html(a);
alert(a)
$.each(a, function( key, value ) {
$("#workSpace").html(key + ": " + value);
});
})
.fail(function(a) {
$("#workSpace").html(a);
})
.always(function(a) {
var example = Object.keys(a)
$.each(example, function( key, value ) {
$("#workSpace").html(key + ": " + value);
});
});
});
I expected work with objects or array passed by PHP like this.
{id:1, name: hola, description: That's an example}
{id:2, name: hello, description: That's nice}
{id:3, name: welcome, description: That's so way}
However, I just only get statusText: OK