title: jquery load page content into div using a stored var
body: <p>I can't explain this but I'm trying to auto detect the page, and place the corresponding submenu for that page...</p>
  
  <p>BASICALLY MY QUESTION IS HOW DO I WRITE THIS LINE...OR??</p>
  
  <pre><code>$( "#navsubmenu" ).load("Templates/navigation.html", submenu);
  </code></pre>
  
  <h2>here is a bit of background:</h2>
  
  <pre><code>//detect url
  var page = window.location.href;
  //strip off url address and get page name
  var page_name = page.substring(page.lastIndexOf('/') + 1);
  //concatenate string nav-submenu to page name and strip off html to get the submenu name
  
  var submenu = '.nav-submenu-' + page_name.substr(0, page_name.lastIndexOf('.'));
  </code></pre>
  
  <p>in this example it is the index page:</p>
  
  <pre><code>&lt;ul class="nav-submenu-index"&gt;
    &lt;li class="sectionTitle"&gt;OF INTEREST&lt;/li&gt;
    &lt;li&gt;&lt;a href="#"&gt;Link #1&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#"&gt;Link #2&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#"&gt;Link #3&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#"&gt;Link #4&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#"&gt;Link #5&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>so basically submenu will be nav-submenu-index if the page loaded is index.html</p>
  
  <p>but I don't know how to write it correctly, this doens't work:</p>
  
  <pre><code>$( "#navsubmenu" ).load("Templates/navigation.html submenu");
  </code></pre>
  
  <p>I tried this and got <strong>ALL</strong> the menus on the while page, not the actual fragment:</p>
  
  <pre><code>$( "#navsubmenu" ).load("Templates/navigation.html", submenu);
  </code></pre>
  
  <p>and the div it writes into is just:</p>
  
  <pre><code>&lt;div id="aside"&gt;&lt;/div&gt;
  </code></pre>