title: phonegap: JQuery document.ready or Phonegap deviceready
body: <p>I am creating phonegap app first time. I have below code which i used to fetch data from server. Problem is this code is working fine if i use document.ready.
  But I read somewhere that i need to use deviceready for phonegap app.</p>
  
  <pre><code>document.addEventListener("deviceready", function(){
      $.ajax({
          type: 'post',
          url: 'uid.php',
          cache: false,
          dataType: 'json',
          data: '&amp;uid=' +uid,
          success: function(data) {
  
            alert(data.count);
  });
  });
  </code></pre>
  
  <p>I tried above code but it is not working. I mean ajax call not firing.</p>
  
  <pre><code>$(document).ready(function() {
          $.ajax({
              type: 'post',
              url: 'uid.php',
              cache: false,
              dataType: 'json',
              data: '&amp;uid=' +uid,
              success: function(data) {
  
                alert(data.count);
      });
      });
  </code></pre>