title: read value of html element stored in variable with jquery
body: <p>In this case:</p>
  
  <pre><code>$.get($(this).attr('href'), function(destino){
      //
  }
  </code></pre>
  
  <p>How I can read the elements  and  which was get from file <strong>$(this).attr('href')</strong> and save them in a variable to use later? </p>
  
  <p>I try this options, and none work:</p>
  
  <p>1)</p>
  
  <pre><code>$titulo = $(destino).get('title');
  $mensagem = $(destino).get('body');
  </code></pre>
  
  <p>2)</p>
  
  <pre><code>$titulo = destino.getElementByName('title');
  $mensagem = destino.getElementByName('body');
  </code></pre>
  
  <p>3)</p>
  
  <pre><code>$titulo = destino.title;
  $mensagem = destino.body;
  </code></pre>
  
  <p>4)</p>
  
  <pre><code>$titulo = $(destino).attr('title');
  $mensagem = $(destino).attr('body');
  </code></pre>
  
  <p>I try this way and appending .text() and .val() on the end of the sentence. Someone can say how this can be made?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Following the suggestion posted on this topic, I write this code:</p>
  
  <pre><code>$('document').ready(function(){
      $('a').click(function(e){
          if($(this).attr('href') != 'logout.html') {
              e.preventDefault();
              $.get($(this).attr('href'), function(destino){
                  var $destino = $(destino);
                  $titulo = $destino.find('title').text();
                  $mensagem = $destino.find('body').html();
                  alert('titulo = '+$titulo+' // mensagem = '+$mensagem)
                  BootstrapDialog.show({
                      title: $titulo,
                      message: $mensagem,
                      draggable: true
                  });
              });
          }
      });
  });
  </code></pre>
  
  <p>but doesn't working. When I try look at the content form $titulo and $mensagem, seems like both are empty and undefined, respectively.</p>
  
  <p><strong>ANOTHER UPDATE</strong></p>
  
  <p>I made another change. Now I have this code:</p>
  
  <pre><code>$('document').ready(function(){
      $('a').click(function(e){
          if($(this).attr('href') != 'logout.html') {
              e.preventDefault();
              $.get($(this).attr('href'), function(destino){
                  var $destino = $(destino);
                  $titulo = $destino.filter('title').text();
                  $mensagem = $destino.filter('body').html();
                  alert('titulo = '+$titulo+' // mensagem = '+$mensagem)
                  BootstrapDialog.show({
                      title: $titulo,
                      message: $mensagem,
                      draggable: true
                  });
              });
          }
      });
  });
  </code></pre>
  
  <p>the value of $titulo is now correct, but the value for $mensagem not.</p>