Hi,
I have some problem with json when i try to work with json object that returned from php,
here is the jquery code:
- $(document).ready(function() {
- $.getJSON('../php/functions/all_city.php',function(data){
- alert(data);
- });
and here is the php code:
- <?php
- require_once 'connection.php';
- $link = conenct('localhost', 'root', '', 'w_db');
- mysql_query( "SET NAMES utf8" );
- mysql_query( "SET CHARACTER SET utf8" );
- mysql_set_charset('utf8', $link);
-
- $query = mysql_query("SELECT cityName FROM city ORDER BY cityName DESC");
- $cityArr = array();
- while($temp = mysql_fetch_assoc($query)){
- array_push($cityArr, $temp['cityName']);
- }
- echo json_encode($cityArr);
- ?>
the data stored in the data base is in Hebrew,
Please help me with this one, I don't know how can turn the json object (which is array in php) to an array in javascript!
thanks!!!