无法使用jQuery获取$ _POST('input').submit()

I was trying to upload a form using jQuery's submit() and success in redirect the page to uploadAll.php, but when I was trying to get the input array using $_POST['inputname'] I can not obtain the value.

I was trying to use serialize() but I get confused in where I should put my PHP page reference.

<form id="regForm" action="uploadAll.php" method="post" enctype="multipart/form-data">
  //some inputs and a hidden input here
</form>
document.getElementById("regForm").submit(function() {
  var inputValues = $(this).serialize();

  $.ajax({
    url: "uploadAll.php",
    type: "POST",
    data: inputValues
  }).done(function(data) {
    alert(data);
  });
});

return false;

Can I just submit without using serialize()? It seems my serialize does not work. Any help is appreciated

trust me, your code is wrong..

try use this code instead:

$("#regForm").on('submit', function(e) {
  e.preventDefault();
  var inputValues = $(this).serialize();

  $.ajax({
    url: "uploadAll.php",
    type: "POST",
    data: inputValues
  }).done(function(data) {
    alert(data);
  });
});