title: How to load MathJax dynamically?
body: <p>I'm trying to use MathJax to convert text into mathematics while typing, using a textarea field. However when I send the typed text to a database to retrieve the text through a php file back to the original file, I can't get MathJax to convert the text into LaTeX-like symbols.</p>
  
  <p>This is the main part (using jQuery):</p>
  
  <pre><code>$(document).ready(function(){
  $('textarea').keydown(function(){ 
      dynamic(); \\ A function described in MathJax documentation to load dynamically
      var text = $('textarea').val();
      $.post('process.php',{ input: text } );
      $("#unload").load('fetch.php');
      });
  });
  </code></pre>
  
  <p>where dynamic() is defined as (taken from <a href="http://www.mathjax.org/resources/docs/?dynamic.html" rel="nofollow">Loading MathJax Dynamically</a>): </p>
  
  <pre><code>function dynamic(){var script = document.createElement("script");
  script.type = "text/javascript";
  script.src = "http://miql.zxq.net/MathJax/MathJax.js"; 
  var config = 'MathJax.Hub.Config({ config: "MathJax.js" }); ' +
  'MathJax.Hub.Startup.onload();';
  if (window.opera) {script.innerHTML = config}
  else {script.text = config}
  document.getElementsByTagName("head")[0].appendChild(script);
  };
  </code></pre>
  
  <p>Furthermore, I have the regular script to MathJax which works alright but uses an onload event.</p>
  
  <p>I think I'm getting wrong the instructions to load MathJax dynamically. What is the correct way to do it? Any help will be greatly appreciate it. </p>