I've been working on a JavaScript code that validates user input against data from a local database through AJAX calls.
<script type="text/javascript">
var button = document.querySelector("#next");
var data = (<%=this.json%>); var count = data.sub.length;
var ans = data.sub[answerPointer].answ;
button.addEventListener('click', function() {
imagePointer++;
answerPointer++;
updateImage();
updateAnswer();
});
(function check () {
'use strict';
var snackbarContainer = document.querySelector('#demo-toast-example');
var showToastButton = document.querySelector('#demo-show-toast');
showToastButton.addEventListener('click', function () {
'use strict';
var x = document.getElementById("numb").value;
if (x == ans) {
var text = "Correct answer, good job!";
}
else {
var text = "Incorrect, try again!";
}
var data = { message: text};
snackbarContainer.MaterialSnackbar.showSnackbar(data);
});
}());
Some of the code has been omitted for clarity.
Now, my query is how can I transmit data (such as adding "true" or "false" to a specific column) to the server-side of the ASPX page.