I am trying to understand how to send two arrays to my php script using AJAX, initially i was simply allowing the page to reload.
I have started implementing the AJAX call however i am just confused on how to send the two arrays. Also how i would use the data in my php file.   This is what i have so far :
<head>
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
</head>
<form method="post" action="submit.php" >
<input id="name" type="text" name="name[]" class=""/>
<input id="amount" type="text" name="amount[]" class=""/>
<button type="submit"  class="btn btn-primary btn-lg btn-block sendTheForm" name="sending" >Submit</button>
</form>
<script>
$(document).on('click', '.sendTheForm', function(){  
    $.ajax({  
       url:"submit.php",  
       method:"POST",  
       data:{},  
       success:function(data){
            swal({
               title: "Submitted",
               text: "sucessfully sent",
               icon: "success",
            });
        }  
     });  
  }
});
</script>
Any help on this would be greatly appreciated and hopefully i will learn a thing or two!
 
     
     
    