The problem is in the routine
(function () {
var QUEUE = MathJax.Hub.queue;
var math = null;
QUEUE.Push(function () {
math = MathJax.Hub.getAllJax("math")[0];
});
QUEUE.Push(["Text",math,"1+x=2"]);
})();
Note that the two QUEUE.Push commands are performed at the time this function runs (right after MathJax is loaded and before the page body is even created). That means MathJax hasn't run yet, and the function from the first QUEUE.Push has not been performed when the second QUEUE.Push is done. At that point, the math variable is null, and so when QUEUE.Push tries to turn ["Text",math,"1+x=2"] into a callback, it can't because math isn't an object that has a Text method (math is null). That is, you are trying to use math before it has its value.
What you should do is get math and set its text in the same function pushed onto the queue. In fact, you don't need the outer closure at all. Simply do
MathJax.Hub.Queue(function () {
var math = MathJax.Hub.getAllJax("math")[0];
return math.Text("1+x=2");
});
Also, note that ${}$ in TeX is an empty expression, but for AsciiMath, it is actually an open and close brace. Perhaps you want to use $ $ instead.
Davide