Choose 1 form to submit with multiple forms on page

Choose 1 form to submit with multiple forms on page

I have a page with multiple forms on it.  Each form as different id but same name and consist of only radio buttons.  I want to perform a submit via ajax but U am having a hard time only choosing the correct form in my code.  What do I need to only submit the form where the radio button is selected.  I have it working fine with only one form on the page.

  1. <form id="1" name="myForm">

    <input type="radio" name="contract" value="0" class="custom-switch-input" checked>

    <input type="radio" name="contract" value="1" class="custom-switch-input" >

    <input type="radio" name="contract" value="2" class="custom-switch-input" >

    <input type="radio" name="contract" value="3" class="custom-switch-input" >


    1. $(document).ready(function()
    2.  {
    3. $(document).ajaxSuccess(function()
    4. {
    5. $("#output").fadeTo(4000, 500).slideUp(500, function(){
    6.         $("#output").slideUp(500);

    7.      });
    8.  });
    9.    $('input[type="radio"]').click(function(){
    10.         var contract = $(this).val();
    11.     var id = $('input[name=id]').val();
    12.         var table = $('input[name=table]').val();
    13.         
    14.         $.ajax({
    15.              url:"edit_do.php",
    16.              method:"POST",
    17.              data:{
    18.                contract: contract,
    19.                id:id,
    20.                table:table
    21.              },
    22.         });
    23.    
    24.    });

    25. });
    26.  </script>