I've got a problem with sending json data.
Here's my php file:
<?php
session_start();
$con = mysql_connect("localhost","root","");
if (!$con) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("db", $con);
$result_array = array();
$result = mysql_query("SELECT Reg FROM bool");
while ($row = mysql_fetch_array($result))
$result_array[] = $row;
echo json_encode($result_array);
mysql_close($con);
?>
And here's my js script:
$(function () {
$(document).ready(function() {
$.getJSON("sql_bool.php", function(data) {
alert(data[1]);
});
});
});
I've got some bool data stored in my database, and when i try to check with an alert() function if it made it through, all i get is an alert window with
[object Object]
Any idea what's wrong?