Time again for my favorite MathJax documentation link:
http://www.mathjax.org/docs/1.1/typeset.html
You see, MathJax needs to be told that the innerHTML has changed, so
that it can process the new math content.
But there is another problem with your code, which you seem to have
anticipated: yes, you need to use double-backslashes when the TeX
code is in a JavaScript string -- so in your code:
document.getElementById("MyEquation").innerHTML='\\( \\frac{x^2-1}
{x^2+1}=3 \\)';
But after the innerHTML is set like this, you have to find a place to
call:
MathJax.Hub.Queue(["Typeset",MathJax.Hub,"MyEquation"]);
You could just do this in the next line of your display_eq() method.