title: How to set the href in a DataTables button?
body: <p>I use DataTables to format my tables. I also use their plugins for Buttons. I am trying to create a custom button to redirect to a different page where I'll create an Excel file for download. I'm just not sure how to set the <code>href</code>. I've tried this:</p>
  
  <pre><code>$.fn.dataTable.ext.buttons.export =
  {
      className: 'buttons-alert',
      text: "Export All Test III",
      action: function (e, dt, node, config)
      {
          var SearchData = dt.rows({ filter: 'applied' }).data();
          var OrderData = dt.order();
          alert("Test Data for Searching: " + SearchData);
          alert("Test Data for Ordering: " + OrderData);
      },
      href: './AjaxHandler.php'
  };
  </code></pre>
  
  <p>The <code>href</code> is ignored and not set. I need to set the <code>href</code>. </p>
  
  <p>How do I do this?</p>
  
  <p>I can see in the Dev Tools in Firefox that it has the property, but it is set to # like this:</p>
  
  <p><a href="https://i.stack.imgur.com/WJ6Kw.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/WJ6Kw.jpg" alt="enter image description here"></a></p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I have since tried setting the <code>href</code> after initialization like this:</p>
  
  <pre><code>$('.dt-button.buttons-alert').attr('href', './AjaxHandler.php');
  
  
  document.querySelector('.buttons-alert').setAttribute('href', './AjaxHandler.php');
  </code></pre>
  
  <p>Neither one of these works, though, the <code>href</code> still shows only the #.</p>