You need to query your data from a database or from somewhere else in PHP. Then, you can echo it with PHP in a JSON format. In a second step, you can use jQuery or plain JavaScript to make an Ajax call to this PHP file and make something with it.
PHP (data.json.php):
<?php
  header('Content-Type: application/json');
  $output = array();
  // query the data from somewhere
  $output['data'] = "1234";
  echo json_encode($output); // json_encode creates the json-specific formatting
?>
JavaScript (jQuery):
$.ajax({
   url: "data.json.php",
   success: function(result){
      console.log(result);
   }
});
The code is untested, but I think you should get the idea.