title: Saving the page title in a variable so that it is accessible after post
body: <p>I am trying to create a 'quick and simple' breadcrumb trail for my site. As my site will only ever have 3 levels, the final ever output could only be:</p>
  
  <p><strong>Home  >  Search Product (multiple product types) > Product Details</strong></p>
  
  <p>I have attempted to write a custom breadcrumb.</p>
  
  <p>In effect, what I am doing is capturing the page title, and displaying that with HREF to the page URL. This works great when going from Home to perform a search:</p>
  
  <p><strong>Home > Search Chairs</strong></p>
  
  <p>However, after performing a search, and I click on an item I wish to view more detail about (my page performs a post), and once on the details page, my breadcrumb displays:</p>
  
  <p><strong>Home > Chair Details</strong></p>
  
  <p>What I was hoping for is:</p>
  
  <p><strong>Home > Search Chairs > Chair Details</strong></p>
  
  <p>Is there a way I can achieve this?</p>
  
  <p><strong>Current code:</strong></p>
  
  <pre><code>function createBreadcrumb() {
  
  alert($(document).find("title").text());
  
      var $pageTitle = $(document).find("title").text();
      var $pageURL = $(location).attr('href');
  
      $('.breadcrumb').html(('&lt;a href="/"&gt;Home &lt;/a&gt; &gt; ') + ('&lt;a href="' + $pageURL + '"&gt;' + $pageTitle + '&lt;/a&gt; '));
  }
  </code></pre>
  
  <p><strong>****Update following Harrys suggestion:<em>*</em></strong></p>
  
  <pre><code>$(function() {
      /* create page breadcrumb on initial page load */
      createBreadcrumb();
  });
  
  function createBreadcrumb(oldPagePass) {
  
  if (oldPagePass !== null &amp;&amp; oldPagePass !== undefined) {
  
      var $pageTitle = $(document).find("title").text();
      var $pageURL = $(location).attr('href');
  
      $('.breadcrumb').html(oldAgePass + ('&lt;a href="' + $pageURL + '"&gt;' + $pageTitle + '&lt;/a&gt; '));
  }  
  else {
      alert($(document).find("title").text());
  
      var $pageTitle = $(document).find("title").text();
      var $pageURL = $(location).attr('href');
  
      $('.breadcrumb').html(('&lt;a href="/"&gt;Home &lt;/a&gt; &gt; ') + ('&lt;a href="' + $pageURL + '"&gt;' + $pageTitle + '&lt;/a&gt; '));
    }    
  }
  
  .ajaxSuccess(function() {
  
  var $pageTitle = $(document).find("title").text();
  var $pageURL = $(location).attr('href');
  
  var $oldPage = $('.breadcrumb').html(('&lt;a href="/"&gt;Home &lt;/a&gt; &gt; ') + ('&lt;a href="' + $pageURL + '"&gt;' + $pageTitle + '&lt;/a&gt; '));
  
  createBreadcrumb($oldPage);
  });
  </code></pre>
  
  <p><strong>Code Update:</strong></p>
  
  <p>jQuery Function</p>
  
  <pre><code>.on('click', '.searchResult', function() {
  var row = $(this);
  $('#resultForm &gt; *').filter(':input').each(function(index, el) {
      var name = $(el).attr('name').slice(8).toLowerCase();
      var data = row.data(name);
      if (data !== 'undefined')
          $(el).val(data);
  });
  
  $('#resultForm').submit();
  })
  </code></pre>
  
  <p>Search page form tag:</p>
  
  <pre><code>&lt;form:form method="post" id="resultForm"&gt; &lt;/form:form&gt;
  </code></pre>