I am trying to pass arrays from PHP into javascript by using json_encode
but when i alert the values i just see "Object object etc"
when i var_dump it i see the actual arrays but its not showing them in the alert
Any help would be appreciated
Regards
this is the var_dump
array(1) {
  [0]=>
  array(2) {
    ["id"]=>
    string(19) "3.0268"
    ["postcode"]=>
    string(137) "hello"
  }
}
array(2) {
  [0]=>
  array(2) {
    ["id"]=>
    string(19) "3.0268070455319E+17"
    ["postcode"]=>
    string(137) "ECMWF continues its flip-flopping, still a temp drop next week & #snow risk but then no rise, http://t.co/tBlg9Ihs #ukweather #uksnow"
} Code
<?php
 $con =  mysql_connect('localhost', 'root', '');
    mysql_select_db('test');
   $result = mysql_query("SELECT * FROM address");
$arr = array();
while($row = mysql_fetch_assoc($result)) {
    $arr[] = $row; 
}
?>
<script>
var test = <?php echo json_encode($arr); ?>;
alert(test);
</script>
 
     
    