The problem is that when you do
math = MathJax.Hub.getAllJax(element)[0];
there is no math in the element to get, and so math is given the null value. Then when you go to make the callback from ["Text",math,MathML], math is null, and this isn't a valid callback specification, so MathJax complains. The MathJax.Hub.getAllJax(element) call returns an array of ElementJax objects that correspond to the typeset mathematics within the element. Your element doesn't have any typeset math initially, so getAllJax() returns an empty array and getAllJax()[0] is a null object.
It is not clear what exactly you want to happen. If you are trying to replace the "hello click here" by the mathematics, then this isn't the way to go about it. In that case, your dothis() function should be something more like
window.dothis = function (element) {
if (typeof(element) === "string") {element = document.getElementById(element)}
element.innerHTML = '<math><mi>x</mi><mo>=</mo><mrow><mfrac><mrow><mo>−</mo><mi>b</mi><mo>±</mo><msqrt><msup><mi>b</mi><mn>2</mn></msup><mo>−</mo><mn>4</mn><mi></mi><mi></mi></msqrt></mrow><mrow> <mn>2</mn><mi>a</mi> </mrow></mfrac></mrow><mtext>.</mtext></math>';
MathJax.Hub.Queue(["Typeset",MathJax.Hub,element]);
}
Is that what you are trying to do?
Davide