18
18
* Author: Nick Chadwick
26
21
function tog(something)
28
23
$('#' + something).toggle("slow");
26
function save_exercise()
29
var exercise_id = $('#exercise_id').val();
30
var exercise_name = $('#exercise_name').val();
31
var exercise_num_rows = $('#exercise_num_rows').val();
32
var exercise_desc = $('#exercise_include').val();
33
var exercise_partial = $('#exercise_partial').val();
34
var exercise_solution = $('#exercise_solution').val();
35
var exercise_include = $('#exercise_include').val();
37
var callback = function(xhr)
42
testresponse = JSON.parse(xhr.responseText);
43
alert(testresponse['result']);
44
window.location.reload();
49
alert('Error updating Exercise');
54
update_path = "api/+exercises/" + exercise + "/+edit";
56
var args = {'name': exercise_name, 'description': exercise_desc,
57
'partial': exercise_partial, 'solution': exercise_solution,
58
'include': exercise_include, 'num_rows': exercise_num_rows,
59
'ivle.op': 'update_exercise'};
60
ajax_call(callback, update_path, "", args, 'POST');