title: Trigger link click on Ajax success
body: <p>I need to trigger a link click on Ajax success. The code that I currently have is:</p>
  
  <pre><code>jQuery.ajax({
  //Ajax Options
  success: function(value) {
      jQuery('.parent_selector').html(jQuery(value).find('.child_selector'));
      jQuery('.test-link').trigger('click');
  },
  error: function() {
      //alert(error);
  } });
  </code></pre>
  
  <p>The Ajax part works fine and I am able to load the <code>.parent_selector</code> div with Ajax response data. After this I need to trigger a link click for which I have <code>jQuery('.test-link').trigger('click');</code> in the above code. However, the link click is never triggered. To check, I moved <code>jQuery('.test-link').trigger('click');</code> within <code>jQuery(document).ready(function()</code> to see whether the link is triggered on page load. But it does not work there as well. The next thing I tried was to put <code>jQuery('.test-link').trigger('click');</code> within click event of another link, as below:</p>
  
  <pre><code>jQuery('section[role="main"]').on('click', '.another-link', function(e){
  e.preventDefault();
  
  jQuery('.test-link').trigger('click');
  </code></pre>
  
  <p>});</p>
  
  <p>Voila!, it works within a click event of another link. So, I am really confused as to what am I doing wrong here. Why <code>jQuery('.test-link').trigger('click');</code> does not want to play nice with Ajax success call?</p>