title: Jquery trigger click after ajax call
body: <p>I have an ajax call and at the end of it I'm setting <code>href</code> for anchor tag and want to click it but am unable to do so. Here is my code:</p>
  
  <pre><code>&lt;div&gt;
      &lt;a id="hypSendEmail"&gt;email&lt;/a&gt;
  &lt;/div&gt;
  
  $("body").on("click", "#btnPopulateEmails", function () {
          var $form = $("#btnPopulateEmails").parents('form');
          $.ajax({
              type: "POST",
              url: url,
              async: true,
              data: $form.serialize()
          }).done(function (data) {
              var json = data,
              obj = JSON.parse(json);
              if (obj.MessageType == "success") {
                  $("#hypSendEmail").attr('href', obj.MessageLink);
                  $("#hypSendEmail").trigger("click");
                  //$("#hypSendEmail").click();
                  $.colorbox.close();
              }
              if (obj.MessageContent != null) {
                  //do something else
              }
          });
          return false;
      });
  </code></pre>
  
  <p>I believe I have to somehow use <code>.on</code> function to trigger that click maybe? Please help. My purpose is to populate hyperlink with mailto &amp; click it automatically. I tried doing this on code behing using <code>Process.Start()</code> &amp; <code>Response.Redirect()</code>, but both failed, so now I'm trying my luck here. It does populate <code>href</code> tag on my anchor tag, but just doesn't click it.</p>