title: Ajax anchor Link trigger not working
body: <p>I am using <code>html2canvas javascript</code> to convert html <code>div</code> to <code>image</code> file. All script are working good and it converts html div to image properly. </p>
  
  <p>But when I am adding response(anchor link) to <code>href</code> and triggering it using ajax it is not triggering anchor link.</p>
  
  <p>Here is my code,</p>
  
  <p><strong>Html code:</strong></p>
  
  <pre><code>&lt;div id="mainDiv"&gt;
  
  &lt;h1&gt;Heading H1&lt;/h1&gt;
  &lt;p&gt;Download Image using ajax and php&lt;/p&gt;
  
  &lt;/div&gt;
  
  &lt;div&gt;
  &lt;a id="download"&gt;Download Image&lt;/a&gt;&lt;br/&gt;
  &lt;a id="download-image" href="" download&gt;Download&lt;/a&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>Ajax code</strong></p>
  
  <pre><code>&lt;script&gt;
  
      $('#download').on('click', function () {
  html2canvas([document.getElementById('mainDiv')], {
      onrendered: function (canvas) {
          var imagedata = canvas.toDataURL('image/png');
          var imgdata = imagedata.replace(/^data:image\/(png|jpg);base64,/, "");
          //ajax call to save image inside folder
          $.ajax({
              url: 'save_image.php',
              data: {
                     imgdata:imgdata
                     },
              type: 'post',
              success: function (response) {   
                 $('#download-image').attr('href', response).trigger('click');
                 //$('#downlaod-image').trigger('click');
              }
          });
      }
  });
  });
  
  &lt;/script&gt;
  </code></pre>