Commit a8d0bafc by Piotr Mitros

Show answer appears to work

parent 19685574
...@@ -9,3 +9,6 @@ ...@@ -9,3 +9,6 @@
% if save_button: % if save_button:
<input id="save_${ id }" type="button" value="Save" > <input id="save_${ id }" type="button" value="Save" >
% endif % endif
% if answer_available:
<input id="show_${ id }" type="button" value="Show Answer" >
% endif
...@@ -22,6 +22,13 @@ function ${ id }_load() { ...@@ -22,6 +22,13 @@ function ${ id }_load() {
}); });
} }
}); });
$('#show_${ id }').click(function() {
$.getJSON('/modx/problem/${ id }/problem_show', function(data) {
for (var key in data) {
$("#answer_${ id }_"+key).text(data[key]);
}
});
});
$('#save_${ id }').click(function() { $('#save_${ id }').click(function() {
var submit_data={}; var submit_data={};
$.each($("[id^=input_${ id }_]"), function(index,value){ $.each($("[id^=input_${ id }_]"), function(index,value){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment