$(document).ready(function () { // ajax function to call PHP script on webserver $.ajax({ type: "POST", // use what "type" is necessary, POST is most common url: "getDatabaseTable.php", // path to .php file that will be executed dataType: "json", // return type of the PHP script success: function (data) { console.log("successfully called PHP file!") console.log(data) // implement logic to write json into HTML here }, error: function () { console.log("failed to call PHP file!") } }); })