Added code to get comments from database
This commit is contained in:
58
get_text_data.html
Normal file
58
get_text_data.html
Normal file
@@ -0,0 +1,58 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Form Submit Example</title>
|
||||
<style>
|
||||
textarea {
|
||||
width: 100%;
|
||||
height: 200px;
|
||||
margin-top: 1em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<form id="qidForm">
|
||||
<label for="qidInput">Enter QID:</label>
|
||||
<input type="text" id="qidInput" name="qid" required /><br />
|
||||
|
||||
<label for="survey">Survey: (SV_cwKjMqAqGxImjMG)</label>
|
||||
<input type="text" id="survey" name="survey" required /><br />
|
||||
|
||||
<label for="Q1">Enter Q1:</label>
|
||||
<input type="text" id="Q1" name="Q1" /><br />
|
||||
|
||||
<label for="Q2">Enter Q2:</label>
|
||||
<input type="text" id="Q2" name="Q2" /><br />
|
||||
|
||||
<label for="Q3">Enter Q3:</label>
|
||||
<input type="text" id="Q3" name="Q3" /><br />
|
||||
|
||||
<button type="submit">Get Counts</button>
|
||||
</form>
|
||||
|
||||
<textarea id="output" readonly placeholder="Results will appear here..."></textarea>
|
||||
|
||||
<script>
|
||||
document.getElementById('qidForm').addEventListener('submit', async function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
const formData = new FormData(this);
|
||||
|
||||
try {
|
||||
const response = await fetch('get_text_data.php', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
});
|
||||
|
||||
const text = await response.text();
|
||||
document.getElementById('output').value = text;
|
||||
} catch (error) {
|
||||
document.getElementById('output').value = 'Error: ' + error.message;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user