mathjax in django

function updateWebsite(api_data) {

// @note update website

// remove hidden container solutionCard

// Select the element with the id “solutionCard”

const solutionCard = document.getElementById(‘solutionCard’);

// Remove the ‘hidden’ attribute

solutionCard.removeAttribute(‘hidden’);

// if data.point_loads is not empty

if (api_data.point_loads !== null) {

// for each line_N in data.point_loads get latex code and insert in solutionBody id using mathjax

let pointLoads = document.getElementById(‘point-loads’);

// empty solutionBody

pointLoads.innerHTML == ;

pointLoads.innerHTML += \[ ‘;

for (let i = 0; i < Object.keys(api_data.point_loads).length; i++) {

let line = ‘line_’ + i;

let latex = api_data.point_loads[line];

pointLoads.innerHTML += latex +\n;

}

pointLoads.innerHTML += \]’;

}

};

Read more here: Source link