title: how to get div's text to a variable
body: <p>what I mainly want to do is to get the div's content and pass it in a variable. To explain what I have done until now :</p>
  
  <p>I have my php file that contains the code :</p>
  
  <pre><code>&lt;?php
  $connect = mysql_connect("localhost", "...","...") or die("Could not connect to the database.");
      mysql_select_db("...") or die("Could not find database &lt;...&gt;");
  
      $query = mysql_query("SELECT id FROM datainput WHERE id&gt;=ALL(SELECT id FROM datainput)") or die("Query could not be executed");
      $row = mysql_fetch_assoc($query);
  
      echo $row['id'];
  ?&gt;
  </code></pre>
  
  <p>In my index.php file I have written the following script :</p>
  
  <pre><code> &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt;
          &lt;script type="text/javascript"&gt;
  
              $("document").ready( function(){
                  //setInterval("checkForNewData()", 1000);  //30 Minutes = 1800000 Milliseconds
                  checkForNewData();
              });
  
              function checkForNewData(){
                  $("#lastid").load("lastData.php");
                  var mydata = $("#lastid").text();
              }  
  
          &lt;/script&gt;
  </code></pre>
  
  <p>In my html tag I have a div with id="lastid".
  With the code below :</p>
  
  <pre><code> var mydata = $("#lastid").text();
  </code></pre>
  
  <p>I want to keep the current text of lastid div, so I can later compare it with another.</p>
  
  <p>As I have read here, this should have done mydata="6" (is the current result)?
  What am I doing wrong?</p>
  
  <p>Can anyone help? Pleaseee...</p>