I've read dozens of related posts, but I still can't get this to work.
I want to alert the response in jquery I get from PHP.
PHP:
$msg=array();
if(empty($whatever)){
$msg['cenas']="Não há contas";
}else{
$msg['cenas']="Há contas";
};
echo json_encode($msg);
JS:
$.ajax({
url: 'myscript.php',
dataType: 'json',
success: function(response){
alert(response.cenas);
}
});
PHP is echoing
{cenas: "Há contas}" But I can't get it to alert in JS.