I have this code which should convert it's results to json. I want to get the array with js and print it.
$db = new PDO('mysql:host=localhost;dbname=Contact', 'root', '');
$statement=$db->prepare("SELECT * FROM myfeilds");
$statement->execute();
$results=$statement->fetchAll(PDO::FETCH_ASSOC);
$json=json_encode($results);
How can I do this ?
$(document).ready(function() {
$.ajax({
type : 'POST',
url : 'server.php',
success : //........
});
});