title: Redirect to (currenturl)/example.html onclick with JavaScript
body: <p>I'm trying to have my location change from 'currentUrl' to 'currentUrl/somePage.html' when you click a button. </p>
  
  <p>It's important that the code isn't reliant on having a hard-coded url. Instead, it should grab the current url that the user is sitting at and append the value of '/somePage.html' to the end of it.</p>
  
  <p>I've done some looking and found that window.location.href will return my current url location, and that window.location will redirect me to a new one. However, when I try putting these together, I'm getting a "function not defined" error when I click my buttons. </p>
  
  <p>My code looks something like this... </p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;button class="btn btn-default" onclick="redirectToPage()"&gt;Some Page&lt;/button&gt;
  </code></pre>
  
  <p>JS: </p>
  
  <pre><code>$(function () {
  
      function redirectToPage() {
          var url = window.location.href;
          window.location(url + "/somePage.html");
      }
  });
  </code></pre>
  
  <p>You're all beautiful people! Thanks for the help!</p>