title: Printing Python output in HTML
body: <p>I have a Python script (which works and outputs correctly when ran) but I am having trouble posting the output to a HTML page.</p>
  
  <p>No errors are being shown.</p>
  
  <p>I am new to Python.</p>
  
  <p><strong>PYTHON</strong></p>
  
  <pre><code>import urllib2
  
  def internet_on():
      try:
          response=urllib2.urlopen('http://64.233.160.94',timeout=1)
          return '&lt;img class="right" src="networkon.png" width="32" height="32"&gt;'
      except urllib2.URLError as err: pass
      return '&lt;img class="right" src="networkoff.png" width="32" height="32"&gt;'
  
  output = internet_on()
  print output
  </code></pre>
  
  <p><strong>HTML/AJAX/JAVASCRIPT</strong></p>
  
  <pre><code> &lt;!DOCTYPE html&gt;
      &lt;html&gt;
      &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;link rel="stylesheet" href="style.css"&gt;
      &lt;script type="text/javascript"&gt;
      function wifi() {
          $.ajax ({
              type: "POST",
              urlurl: "file:///home/pi/Desktop/wifi.py",
              data: output,
              dataType: "html",
              success: function(responcew){
                  $("wifi").html(responcew);
              }
          });
      }
      &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
      &lt;div id="topbar"&gt;
          &lt;span id="wifi"&gt;&lt;/span&gt;
      &lt;/div&gt;
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>I have also tried:</p>
  
  <pre><code>function wifi() {
      $.ajax ({
          type: "POST",
          urlurl: "file:///home/pi/Desktop/wifi.py",
          data: output,
          dataType: "html"
      });
      document.getElementById('wifi').innerHTML;
  }
  </code></pre>