title: Get value from div in a html string with jquery and ajax
body: <p>I have a problem when i try to grab the value from a div in my html string. Maybe someone here could find the problem for me.</p>
  
  <p>I have tried a lot of different ways to take the data out. Solutions that works for others don't work for me at all. So i think i am doing something seriously wrong</p>
  
  <pre><code>$(document).ready(function () {
      var id = 1;
  
      function updateMsg() {
          $.ajax({
              url: "/opt/history/update?current=" + 1,
              cache: false,
              success: function (html) {
                  id = $(html).find('#last').html();
                  console.log('ID: ' + id);
                  $("#result").html(html);
              }
          });
          setTimeout(updateMsg, 5000);
      }
  
      updateMsg();
  });
  </code></pre>
  
  <p>This is how the div looks like</p>
  
  <pre><code>&lt;div id="last" style="display: none;"&gt;2&lt;/div&gt;
  </code></pre>
  
  <p>There is a bunch of html code before this div. This div will always be at the bottom of the html string. </p>
  
  <p><strong>Update:</strong> The thing is. I need to transport the value of a id in this html string but not show it visually. If you have a better way that i should look at.</p>
  
  <p>The HTML output on success</p>
  
  <pre><code>&lt;tr&gt;
  &lt;td&gt;2014-07-08 14:35:47.456&lt;/td&gt;
  &lt;td&gt;123&lt;/td&gt;&lt;td&gt;321&lt;/td&gt;
  &lt;td&gt;Has data&lt;/td&gt;
  &lt;td&gt;&lt;a data-toggle="modal" data-request="2014-07-08 14:35:47.456" data-mobile="123" data-check="321" data-log="Has latest update" data-context="Context" data-historyid="28" title="info" class="open-logInfo btn btn-default" href="#logInfo"&gt;
  &lt;i class="icon-info-sign icon-black"&gt;&lt;/i&gt; Info &lt;/a&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;div id="last" style="display: none;"&gt;28&lt;/div&gt; 
  </code></pre>