Commit 15d4af26 by Victor Shnayder

Merge pull request #899 from MITx/feature/victor/capa-ajax

Make chem preview more robust
parents 97233cf0 f4d8df94
......@@ -29,11 +29,9 @@
% endif
</p>
<div class="equation">
<div id="input_${id}_preview" class="equation">
</div>
<p id="answer_${id}" class="answer"></p>
% if status in ['unsubmitted', 'correct', 'incorrect', 'incomplete']:
......
(function () {
update = function() {
preview_div = $(this).siblings('div.equation');
function create_handler(saved_div) {
return (function(response) {
if (response.error) {
......@@ -12,6 +10,9 @@
});
}
prev_id = "#" + this.id + "_preview";
preview_div = $(prev_id)
$.get("/preview/chemcalc/", {"formula" : this.value}, create_handler(preview_div));
}
......
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