title: Jquery ajax append html file based on url
body: <p>so far i have a simple script to include few html files on all pages. What i would like to achieve is to include specific file based on the folder in the url that visitor is currently on and define those folder names, for example:</p>
  
  <ul>
  <li>If /page-1/index-1.html (include demo-1.html)</li>
  <li>If /page-1/index-2.html (include demo-1.html)</li>
  <li>If /random-page/test.html (include demo-1.html)</li>
  <li>If /page-2/index-1.html (include demo-2.html)</li>
  <li>If /page-2/index-2.html (include demo-2.html)</li>
  <li>If /another-folder/test.html (include demo-2.html)</li>
  <li>... and so on</li>
  </ul>
  
  <p>Currently i include both demo-1.html and demo-2.html on all pages, but this is not working for me as the content inside those two files is different per folder. The script i use:</p>
  
  <p><code>$.ajax({
      url: "../include/demo-1.html",
      success: function (data) { $('body').append(data); },
      dataType: 'html'
  });</code></p>
  
  <p>Any help appricieted, thanks :)</p>