title: Using ajax to print "testing" to the screen when you click a label
body: <p>I'm trying use ajax to print "testing" to the screen when you click a label, but it's not working for some reason. What am I doing wrong?  </p>
  
  <p><b> test.php </b></p>
  
  <pre><code>&lt;style&gt;
  #output {
    width: 25%;
    height: 25%;
    border: 1px solid black;
  }
  &lt;/style&gt;
  &lt;label value='show time' onclick="ajaxFunc('test1.php', 'output')"&gt; Click me &lt;/label&gt;
  &lt;div id='output'&gt;&lt;/div&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt; 
  function ajaxFunc(gotoUrl, output) {
    $.ajax({
      type: "POST",
      url: gotoUrl,
      error: function(xhr, status, error){
        alert(error);
      },
      success: function(data) {
        document.getElementById( output ).innerHTML = data;
      } //end of success:function(data)
    }); //end of $.ajax
  
  &lt;/script&gt;
  </code></pre>
  
  <p><b> test1.php </b></p>
  
  <pre><code>&lt;?php
  echo "testing";
  ?&gt;
  </code></pre>