gui done enough
This commit is contained in:
@@ -71,7 +71,14 @@
|
||||
}
|
||||
|
||||
function pushAnswer(idq, answer, passed) {
|
||||
console.log(idq, answer, passed)
|
||||
http("post", `/api/questions/${idq}/answers`, noopcallback,
|
||||
JSON.stringify(
|
||||
{
|
||||
"answer": answer,
|
||||
"passed": new Boolean(passed),
|
||||
}
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
function nextQuestion(form) {
|
||||
@@ -110,6 +117,23 @@
|
||||
form.children.answer.retake = todo[1].Retake
|
||||
}
|
||||
|
||||
function noopcallback(responseBody, responseStatus) {
|
||||
console.log(responseStatus, responseBody)
|
||||
}
|
||||
function http(method, remote, callback, body) {
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if (xmlhttp.readyState == XMLHttpRequest.DONE) {
|
||||
callback(xmlhttp.responseText, xmlhttp.status)
|
||||
}
|
||||
};
|
||||
xmlhttp.open(method, remote, true);
|
||||
if (typeof body == "undefined") {
|
||||
body = null
|
||||
}
|
||||
xmlhttp.send(body);
|
||||
}
|
||||
|
||||
nextQuestion(document.getElementById("flash"))
|
||||
</script>
|
||||
</footer>
|
||||
|
||||
Reference in New Issue
Block a user