Created a html with
<div id="math-display"> </div>
Next, on the main.js, retrieve from the database using ajax and pass the data which are in asciimath using json.mathanswer. The aim is to display the return data which are in asccimath as mathematical expression. For example: data retrieved from database is *dy/dx = 3*x^3*. Passed to json.mathanswer.
Have tried using the following code:
$('#math-display').append(json.mathanswer);
or
document.querySelector('#math-display').textContent =json.mathanswer;
The display is still in asciimath, i.e. *dy/dx = 3*x^3*.
Also tried using the delimiters:
$('#math-display').append(`json.mathanswer`);
or
document.querySelector('#math-display').textContent =`json.mathanswer`;
The result is json.mathanswer will be displayed in the space allocated.
How to display the asciimath retrieved as data in mathematical expression html using javascript?