title: showing data in html5 from database using javascript and json
body: <p>I am trying to show a list in html from mysql database.To get data from mysql i am using json and javascript. But it shows nothing!</p>
  
  <p>My html page is </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html class="ui-mobile-rendering"&gt;
  &lt;head&gt;
  &lt;title&gt;&lt;/title&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
  &lt;link rel="stylesheet" href="css/jquery.mobile-1.0.1.min.css"/&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div id="tenant" data-role="page"&gt;
  
      &lt;div data-role="header"&gt;
          &lt;a href="index.html" data-icon="back" class="back ui-btn-left"&gt;Back&lt;/a&gt;
          &lt;h1&gt;My Lease&lt;/h1&gt;
      &lt;/div&gt;
  
      &lt;div data-role="content"&gt;
  
          &lt;ul id="actionList" data-role="listview"  data-inset="true"&gt;
          &lt;/ul&gt;
      &lt;/div&gt;  
      &lt;/div&gt;
  &lt;script src="js/tenantlease.js"&gt;&lt;/script&gt;
  &lt;script src="lib/jquery-1.7.1.min.js"&gt;&lt;/script&gt;
  &lt;script src="js/jqm-config.js"&gt;&lt;/script&gt;
  &lt;script src="lib/jquery.mobile-1.0.1.min.js"&gt;&lt;/script&gt;
  &lt;script src="lib/underscore-min.js"&gt;&lt;/script&gt;
  &lt;script src="lib/backbone-min.js"&gt;&lt;/script&gt;
  &lt;script src="js/main.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>My php file is.It is working fine when i call from browser with id.</p>
  
  <pre><code>&lt;?php
  session_start();
  include 'connection.php';
  $email=$_SESSION["PM"];
  
  $sql = "select * from phpap105_tenantinfo where TenantEmailAddress=:id";
  try {
  $dbh = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass);  
  $dbh-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  $stmt = $dbh-&gt;prepare($sql);  
  $stmt-&gt;bindParam("id", $_GET[id]);
  $stmt-&gt;execute();
  $employee = $stmt-&gt;fetchObject();  
  $dbh = null;
  echo '{"item":'. json_encode($employee) .'}'; 
  } catch(PDOException $e) {
  echo '{"error":{"text":'. $e-&gt;getMessage() .'}}'; 
  }
  ?&gt;
  </code></pre>
  
  <p>My javascript file is</p>
  
  <pre><code>    $('#tenant').live('pageshow', function(event) {
  //var id = getUrlVars()["id"];
  var id = 'mukul_kuet@yahoo.com';
  $.getJSON('tenantlease.php?id='+id, displayEmployee);
      });
  
     function displayEmployee(data) {
  var employee = data.item;
  //console.log(employee);
  
  
  if (employee.TenantFirstName) {
      $('#actionList').append('&lt;li&gt;&lt;h3&gt;First Name&lt;/h3&gt;' +
              '&lt;p&gt;' + employee.TenantFirstName + '&lt;/p&gt;&lt;/a&gt;&lt;/li&gt;');
  }
  if (employee.TenantLeaseSigned) {
      $('#actionList').append('&lt;li&gt;&lt;h3&gt;Lease Sign&lt;/h3&gt;' +
              '&lt;p&gt;' + employee.TenantLeaseSigned + '&lt;/p&gt;&lt;/a&gt;&lt;/li&gt;');
  }
      $('#actionList').listview('refresh');
     }
  </code></pre>
  
  <p>Please help how can i get data in html page.Thanks in advance for any kind of help.</p>