I have been trying to fetch a json array from an external page. Even though it shows in the browser's element inspector, I can't use it in the console or in my code.
jquery code:
$.ajax({
type:"POST",
dataType:"json",
url:"datacenter.php",
success:function(data){
console.log(data.codeName);
},error:function(data){
console.log(data);
}
});
php code:
<?php header('Content-type: application/json'); ?>
insight = {
"code":"v34ns",
"codeName":["sureman","greatboy","namely"]
}