How to pass the id name to the jQuery validation and send to the controller?

How to pass the id name to the jQuery validation and send to the controller?

I have two anchor tag and on click, I have to get the id value.

I have two anchor tag and on click, I have to get the id value.

so I tried below code and I am getting the id. Now after getting the id, I have to display the popup. so popup is also displaying.

<div class="buttonSet">
  <a href="javascript:void(0);" id="sample1">Sample one</a>
  <a href="javascript:void(0);" id="sample2">Sample two</a>
  </div>

$(".buttonSet a").click(function() {
    alert(this.id);//getting the id name, just for an example
    $('#Popup').show();
});

Popup code is

<div class="" id="Popup" style="display:none">
    <form action="" method="post" name="form1" id="form1" autocomplete="off">
      <div class="form-group ffl-wrapper">
        <label for="name" class="ffl-label">Name</label>
        <input type="text" name="name" class="form-control" id="name">
      </div>

  &lt;div class="form-group ffl-wrapper"&gt;
    &lt;label for="email" class="ffl-label"&gt;Email&lt;/label&gt;
    &lt;input type="email" name="email" class="form-control" id="email"&gt;
  &lt;/div&gt;

  &lt;div class="form-group ffl-wrapper"&gt;
    &lt;label for="mobileno" class="ffl-label"&gt;Mobile Number&lt;/label&gt;
    &lt;input type="text" name="mobileno" class="form-control" id="mobileno"&gt;
  &lt;/div&gt;


  &lt;div class="form-group text-center btn_submit_action"&gt;
    &lt;input type="submit" name="send" class="" value="Submit"&gt;
  &lt;/div&gt;
&lt;/form&gt;

</div>

Now I am confused how do I pass the id value to the jQuery validation and how to submit button will work. I mean I have one form and two buttons. The Same form will open on button click. I have to get the information that which button is clicked and pass that button id to the jQuery validation and send to the form. Because I have to store the name of the button which is clicked.

jQuery validation

$("#form1").validate({
  rules: {
    name: {
      required: true,
      minlength: 3,
      lettersonly: true
    },
    email: {
      required: true,
      email: true
    },
    mobileno: {
      required: true,
      minlength: 10,
      maxlength: 10,
      number: true
    }
  },
  submitHandler: function(form) {
    $.ajax({
      url: "//my url",
      type: "POST",
      data: $('#form1').serialize(),
      success: function(data) {
        $("#Popup").hide();
        $("#popup_success").show();
      },
    }); // AJAX Get Jquery statment
  }
});

javascript html jquery

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Know Everything About HTML With HTML Experts

HTML Assignment Help Australia @30% OFF from Sample Assignment, with Our Best HTML assignment help experts. Get HTML homework help online at affordable price. 100% Plag free assignment solution.

HTML JavaScript - Add Javascript File to HTML

Learn HTML and javascript, their uses & importance, html javascript function, javascript tags list, why add javascript file to html, HTML Events with JavaScript etc

Commonly Used HTML Tags with Examples

HTML tags are keywords used in HTML to display web-pages with certain properties. They are further used for defining HTML elements. An HTML element consists of a starting tag.

Building a minesweeper game using Javascript, HTML and CSS

In this article, you'll learn how to build minesweeper using JavaScript, HTML and CSS. I also used jQuery, a JavaScript library that is helpful for interacting with html. Whenever you see a function call with a leading dollar sign, that is jQuery at work

Material Login & Signup Form with CSS, HTML and JavaScript

How we can create a login and signup form with the material design using HTML CSS JavaScript? Solution: See this CSS Material Login & Signup Form With jQuery, Material Design Form.