summaryrefslogtreecommitdiff
path: root/yaksh/static
diff options
context:
space:
mode:
Diffstat (limited to 'yaksh/static')
-rw-r--r--yaksh/static/yaksh/css/exam.css2
-rw-r--r--yaksh/static/yaksh/js/requesthandler.js25
2 files changed, 23 insertions, 4 deletions
diff --git a/yaksh/static/yaksh/css/exam.css b/yaksh/static/yaksh/css/exam.css
index ec48a14..7d10629 100644
--- a/yaksh/static/yaksh/css/exam.css
+++ b/yaksh/static/yaksh/css/exam.css
@@ -4,4 +4,4 @@ table td, table th { border: black solid 1px !important;
}
#stdio, #assertion {
table-layout: fixed
-} \ No newline at end of file
+}
diff --git a/yaksh/static/yaksh/js/requesthandler.js b/yaksh/static/yaksh/js/requesthandler.js
index 9749676..0663a55 100644
--- a/yaksh/static/yaksh/js/requesthandler.js
+++ b/yaksh/static/yaksh/js/requesthandler.js
@@ -53,16 +53,35 @@ function response_handler(method_type, content_type, data, uid){
} else if(content_type.indexOf("application/json") !== -1) {
res = JSON.parse(data);
request_status = res.status;
- if(method_type === "POST") {
- uid = res.uid;
+ if (request_status){
+ if(method_type === "POST") {
+ uid = res.uid;
+ }
+ check_state(request_status, uid);
+ }
+ else{
+ unlock_screen();
+ if ($("#notification")){
+ $("#notification").toggle();
+ }
+
+ var error_output = document.getElementById("error_panel");
+ error_output.innerHTML = res.error;
+ focus_on_error(error_output);
}
- check_state(request_status, uid);
} else {
reset_values();
unlock_screen();
}
}
+function focus_on_error(ele){
+ if (ele) {
+ ele.scrollIntoView(true);
+ window.scrollBy(0, -15);
+ }
+ }
+
function ajax_check_code(url, method_type, data_type, data, uid) {
$.ajax({
method: method_type,