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

Make chem preview more robust
This commit is contained in:
Victor Shnayder
2012-10-14 08:40:39 -07:00
2 changed files with 4 additions and 5 deletions

View File

@@ -29,10 +29,8 @@
% endif
</p>
<div class="equation">
<div id="input_${id}_preview" class="equation">
</div>
<p id="answer_${id}" class="answer"></p>

View File

@@ -1,7 +1,5 @@
(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));
}