both can be divided into separate arrays formatted JSON string returned by the php script? my JS code
function GetData(id){
$.ajax({
url: 'list.php',
data: 'id=' + id,
type: 'POST',
success: function(data){
alert(data)
console.log(data)
}
})
}
my list.php
<?php
$id = $_POST['id'];
$connect = mysql_connect("localhost", "admin", "118326") or die(mysql_errno());
$db = mysql_select_db("flabers", $connect) or die(mysql_error());
$result = mysql_query("SELECT * FROM list WHERE id = '$id'") or die(mysql_error());
$array = mysql_fetch_assoc($result) or die(mysql_errno());
echo json_encode($array);
?>
return json string
{"id":"88","country":"Korea, Japan, USA","brand":"Samsung, Sony, HTC"}
how to get the two arrays country and brand?