title: Datatables jquery dynamically setting ajax url parameter
body: <p>I'm using datatables and retrieving data via ajax from a database:</p>
  
  <pre><code>        ...
          deferRender: true,
          ajax: {
              url: "/api/tracks/classical",
              dataSrc: '',
              contentType: "application/json"
          },
          "columns": [
              { "data": "Category" },
              { "data": "Title" },
           ...
  </code></pre>
  
  <p>When a menu option is selected I want to change the url to read a different set of data and reload the table:
  eg
  /api/tracks/<strong>classical</strong> will become
  /api/tracks/<strong>acoustic</strong></p>
  
  <p>(This is effectively calling the same api with a different parameter.)</p>
  
  <p>I tried setting the new url when the menu is clicked, and when debugging I can see it does call the new url, but then immediately calls the old one again and the table is redrawn the same.</p>
  
  <pre><code> $('#menu-t-acoustic').click(function () {
         $('#mytable').ajax.url('/api/tracks/acoustic').load();
   });
  </code></pre>
  
  <p>So how can I achieve this with jquery/json/datatables?</p>
  
  <p>I'm thinking that the url</p>
  
  <pre><code>    ajax: {
          url: "/api/tracks/classical"
  </code></pre>
  
  <p>should be able to use a variable instead of hard coded string but I don't know any syntax to do this - is it possible?</p>
  
  <p>So... how should I set the ajax url dynamically - and how to I get datatables to reload with the new url?</p>