json encoding 2 dimension array
<p>I have the following in php:</p>

<pre><code>$query = mysql_query($sql);
$rows = mysql_num_rows($query); 
$data['course_num']=$rows;
$data['course_data'] = array();
while ($fetch = mysql_fetch_assoc($query) )
{

    $courseData = array(
    'course_name'=&gt;$fetch['course_name'],
    'training_field'=&gt;$fetch['training_field'],
    'speciality_field'=&gt;$fetch['speciality_field'],
    'language'=&gt;$fetch['language'],
    'description'=&gt;$fetch['description'],
    'type'=&gt;$fetch['type'],
    );

    array_push($data['course_data'],$courseData);
}

echo json_encode($data);
</code></pre>

<p>when I receive the result of this script in jquery (using post) </p>

<p>I log it using :</p>

<pre><code>console.log(data['course_data']);
</code></pre>

<p>and the output is :</p>

<pre><code>[Object { course_name="Introduction to C++",  training_field="Engineering" ,  speciality_field="Software",  more...}]
</code></pre>

<p>But I can't seem to figure out how to access the elements.</p>

<p>I tried</p>

<pre><code>data['course_data'].course_name

data['course_data']['course_name']
</code></pre>

<p>Nothing worked. Any ideas</p>
