I have a page 2.html
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 1.html
which has a list of IDs. What I want is if I click on an ID in 1.html
, that click should pass that ID to 2.html
, submit the form on 2.html
and display that page.
The form in 2.html
:
$("#form").on("submit", function(event) {
$("#results").html("");
$.ajax({
data: {
name: $("#nameInput").val()
},
type: "POST",
url: "/similar"
}).done(function(data) {
/* ... */
});
});
Then click in 1.html
:
$("#id1").on("click", function(e) {});