-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathformScript.js
More file actions
16 lines (16 loc) · 858 Bytes
/
formScript.js
File metadata and controls
16 lines (16 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function showTable(event){//function to show table
event.preventDefault();
var tables = document.getElementById('table').value;//get the value of the table
var httpRequest = new XMLHttpRequest();//create a new XMLHttpRequest object
var form = document.getElementById('form2').value;//get the value of the form
if (!tables || !form) {
console.log("Table or form value is missing.");
}
httpRequest.onreadystatechange = function(){//function to be called when the readyState property changes
if(this.readyState == 4 && this.status == 200){
document.getElementById('show').innerHTML = this.responseText;
}
};
httpRequest.open("GET", "form_process.php?table=" + tables + "&form=" + form, true);//specify the type of request
httpRequest.send();//send the request
}