title: How to download a file on click of a button using JavaScript?
body: <p>I am a newbie on JS and want to be able to download .csv files at the click of a button.
  Currently I have a table showing a delete and a download button. I am not sure how to create a downloadable link with the file path for when clicking on the download button.</p>
  <p>Table</p>
  <pre><code>&quot;&lt;button style='padding: 6px !important;' data-id = &quot; + item.ID + &quot; class='delete'&gt;&lt;img src='/uas_tools/crop_analysis/Resources/Images/delete.png'&gt;&lt;/button&gt;&quot; +
  &quot;&lt;button style='padding: 6.6px !important;' data-id = &quot; + item.ID + &quot; class='download'&gt;&lt;img src='/uas_tools/crop_analysis/Resources/Images/download.png'&gt;&lt;/button&gt;&quot; +
  </code></pre>
  <p>Function</p>
  <pre><code>// onclick of download button
  $(document).on(&quot;click&quot;, &quot;.download&quot;, function() {
          var id = $(this).data('id'); //get id
          var selector = $(this);
          //window.location = _OBJECT_URL;
  
          console.log(&quot;CLICKED&quot;);
          console.log(&quot;id &quot; + id);
  })
  </code></pre>