Hi guys,

I've tried converting PHP array into JavaScript array.

Code:
	<?php
		//Get all data category from database.
		$result = $this->classes_mdl->get_classes_name2();
		
		//convert PHP array to JS array.
		echo "<script>"
		    . "var classnames = " . json_encode($result) . ";"
		    . "</script>";
	?>

	<script>
                //print values for testing only
		document.write(classnames);
	</script>
and the result was,
Code:
[object Object],[object Object],[object Object],[object Object]
So what was my mistake?