title: On button click- do a redirect and ajax post submit form of new page, with data passed from click
body: <p>I have a page <code>2.html</code> where if I submit an ID number, I get some output. It works with Ajax post, in which I send data along with the data parameter. At the same time, I have another page <code>1.html</code> which has a list of IDs. What I want is if I click on an ID in <code>1.html</code>, that click should pass that ID to <code>2.html</code>, submit the form on <code>2.html</code> and display that page. </p>
  
  <p>The form in <code>2.html</code>:</p>
  
  <pre><code>$("#form").on("submit", function(event) {
    $("#results").html("");
    $.ajax({
      data: {
        name: $("#nameInput").val()
      },
      type: "POST",
      url: "/similar"
    }).done(function(data) {
      /* ... */
    });
  });
  </code></pre>
  
  <p>Then click in <code>1.html</code>:</p>
  
  <pre><code>$("#id1").on("click", function(e) {});
  </code></pre>