> The issue I face now is that on first load you can actually see it
> flash the orignal text before the ajax callback executes and MathJax
> renders the content. Is there a typical approach whereby only the
> rendered content actually displays? Or is this an expected result of
> doing this in an ajax call?
It is not unusual for the original text to be visible before MathJax
processes it. If MathJax needs to load any components (like its
output jax the first time it is used), that is done asynchronously, so
the page will be displayed in the meantime until the component is
loaded.
You could set the div's visibility:hidden property before loading its
contents, and then after it is loaded, typeset the math setting
visibility to "" afterward. You would need to use the
MathJax.Hub.Queue to synchronize that. E.g.
$("#DivID").css("visibility","hidden");
$("#DivID").load('@Url.Action("ActionResultMethod", "ControllerName",
{controller parameters})', function () {
MathJax.Hub.Queue(
["Typeset",MathJax.Hub,"DivID"],
function () {
$("#DivID").css("visibility",""); // may have to be "visible"
rather than ""
}
);
});
might work. I don't use jQuery myself, so don't know if this is
correct or not.
> I gather the MathJax.Hub.Typeset() call targets the entire page
> instead of just the div I need. Perhaps that is part of the problem?
No, it is probably an asynchronous file load that is at issue.
> I started out trying to use MathJax.Hub.Queue but never could get
> that to work.
See if the example above helps.
Davide