how to render math-text from JSON file using jQuery

459 views
Skip to first unread message

taewony Kim

unread,
Jan 31, 2012, 11:10:19 PM1/31/12
to mathja...@googlegroups.com
This is a lazy question, but I like to get a help from you.
I'd like to render math-related text from JSON data array and then convert it by MathJax.

How can I make jQuery call MathJax api to render the math_text array right after the following example code? 

$.getJSON(url,
    function(data){
      $.each(data.items, function(i,item){
      $('#testfield').html('<p>' + item.d.math_text + '</p>');
      });
    });


Davide P. Cervone

unread,
Feb 1, 2012, 6:50:18 AM2/1/12
to mathja...@googlegroups.com
$.getJSON(url,
function(data){
$.each(data.items, function(i,item){
$('#testfield').html('<p>' + item.d.math_text + '</p>');
});
MathJax.Hub.Queue(["Typeset",MathJax.Hub,"testfield"]);
});

See http://www.mathjax.org/docs/1.1/typeset.html for more details.

Davide

Reply all
Reply to author
Forward
0 new messages