Code has been added to clipboard!
Calling the PHP Database
Example
<!DOCTYPE html>
<html>
<body>
<h2>JSON data from PHP file.</h2>
<p>The JSON received from the PHP file:</p>
<p id="example"></p>
<script>
var obj, dbParameters, xmlhttp;
obj = { "table":"fruits", "limit":5 };
dbParam = JSON.stringify(obj);
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("example").innerHTML = this.responseText;
}
};
xmlhttp.open("GET", "your_file.php?x=" + dbParam, true);
xmlhttp.send();
</script>
</body>
</html>