I want get a json array from PHP with jQuery, but it is not working.
PHP
$json[] = array(
'status' => 'no',
'xxx' => $myhtml
);
echo json_encode($json);
$myhtml is HTML source.
jQuery
$.post('server.php', {'work' : work , 'view_id' : view_id } , function(data){
var json = JSON.parse(data);
$('#main-show').html(json.xxx);
});
I have array json in console, but json.xxx is undefined.
workandview_id? is jQuery includes correct ?