From 73322a5e6ad4f5d3785432fd7c2467d6c3eff53a Mon Sep 17 00:00:00 2001 From: Piotr Mitros Date: Sun, 19 Feb 2012 17:03:29 -0500 Subject: [PATCH] Capa problems handle case sensitivity and give better errors --HG-- branch : pmitros-capa-fixes --- problem.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/problem.js b/problem.js index e5bc56e3ab..547a1f0e81 100644 --- a/problem.js +++ b/problem.js @@ -13,11 +13,15 @@ function ${ id }_load() { postJSON('/modx/problem/${ id }/problem_check', submit_data, function(json) { - - if(json['success'] == 'syntax') - alert('Syntax error'); - else - ${ id }_load(); + switch(json.success) { + case 'incorrect': // Worked, but answer not + case 'correct': + ${ id }_load(); + //alert("!!"+json.success); + break; + default: + alert(json.success); + } }); log_event('problem_check', submit_data); });